How to Upload Scripting Files to Web Server

33 Replies

  • Can you explain a little more as to what this file does, etc?

    For my linux FTP servers that accept dynamic files from windows server I found it easier to mountain the windows directories on the linux servers and just manage the files on the windows side.

    Was this post helpful? thumb_up thumb_down

  • Rdavid wrote:

    I am sure in that location is someone who can guide me on how to automatically upload a file to a web server in Linux using a shell script. Please advice.

    What method you lot want to upload information technology with? FTP, SCP, telnet or perhaps y'all mean some kind of web course?

    Was this mail helpful? thumb_up thumb_down

  • For simple one-shot file transfers curl is a adept option

    For FTP

    curl -T LocalFile ftp://ftp.my.site

    HTTP put uploads

    curl -T LocalFile http://world wide web.my.site

    To do a post upload y'all demand to examine the HTML code for the form and get the element IDs to build a form submission. For example if there's a form to upload a file and the the input name in the HTML lawmaking is "File123", do something like this:

    curl -F "File123=@my.file"

    http://curl.haxx.se/docs/faq.html

    Was this post helpful? thumb_up thumb_down

  • As Network Overlord said, yous tin can mount a share and just driblet the file into the shared directory.  You can then automate where that file gets moved by scheduling a cron tasks that copies that file to wherever you demand it on the webserver.

    I also like to employ SCP for transferring files.

    Here is the human being page for it:

    http://linux.dice.net/homo/one/scp

    This site has an SSH tutorial (if you don't already have information technology fix) and there'southward a "Using SCP" department that explains the basic usage of the command. http://support.suso.com/supki/SSH_Tutorial_for_Linux

    Was this mail helpful? thumb_up thumb_down

  • Depends on what protocol y'all are using to upload with but bold bash have a await at this http://stackoverflow.com/questions/1894347/how-to-upload-ftp-files-to-server-in-a-bash-script The poster ended up using scp which was secure and a little more than elegant, but if you scroll down yous will find someone else suggesting using a heredocument.

    Here is a more specific and direct version of using the heredocument, take a await ath the 2d post http://www.linuxforums.org/forum/programming-scripting/106665-automatic-ftp-upload-via-script.html

    And notwithstanding even some other example http://snipplr.com/view/27915

    Was this mail helpful? thumb_up thumb_down

  • Automating this is just a thing of creating a beat out script that runs the command y'all desire and sticking information technology in a cron job or something.

    Was this post helpful? thumb_up thumb_down

  • As network overlord sort of hinted at you could likewise actually mount the ftp binder to a mount point (although he was doign this in Windows) and then treat file transfers as mere file commands like cp

    Was this mail helpful? thumb_up thumb_down

  • The file acts more like a log. My Linux System will be having that file in a folder, but I want to upload the file to my web server automatically using shell script and cron. I have looked effectually and am notwithstanding finding difficulties to achieve information technology.

    Was this mail service helpful? thumb_up thumb_down

  • The second link I posted has an almost complete script you can utilise to achieve what you desire with cron.

    Was this mail service helpful? thumb_up thumb_down

  • Rdavid wrote:

    The file acts more than like a log. My Linux System will be having that file in a binder, but I want to upload the file to my web server automatically using vanquish script and cron. I take looked around and am even so finding difficulties to achieve it.

    Easiest way as I noted is to just mount a windows share on linux.

    2d easiest would probably be an ftp server running either on the windows server or linux server and a script to automate the transfer.

    3rd would probably be samba share on linux and automate the transfer through script.

    quaternary installing ssh on windows then writing a script to automate that transfer

    Was this post helpful? thumb_up thumb_down

  • You lot volition take to ready credentials on the spider web server and so y'all can connect without using a password (see a good how-to here: http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/  )

    And then put something like to this in a script:

    BASH

                                                    # Put the log files:                        sftp username@webserver <<!                        cd                        /directory/to/upload/to lcd /localdirectory put logfile.log quit !                      

    Was this post helpful? thumb_up thumb_down

  • Utilise rsync in a cron job...

    human rsync for switches and command layout, here's simple examples:

    rsync [Option] … SRC [SRC] … [USER@]HOST:DEST

    rsync [OPTION] … [USER@]HOST:SRC [DEST]

    Was this postal service helpful? thumb_up thumb_down

  • Scott6185 wrote:

    Utilize rsync in a cron chore...

    man rsync for switches and command layout, here's elementary examples:

    rsync [Selection] … SRC [SRC] … [USER@]HOST:DEST

    rsync [Pick] … [USER@]HOST:SRC [DEST]

    +1 for rsync and cron

    Through an ssh tunnel for added security.

    Was this post helpful? thumb_up thumb_down

  • this is pretty fishy imho, running linux server implies basic knowledge of how some of the stuff works.  My short list of what can exist used to do the flim-flam.

    rsync

    scp

    ssh

    sftp

    nc

    curl

    ftp

    Was this mail service helpful? thumb_up thumb_down

  • Depends some people inherited Linux servers and have almost no noesis, or they followed some how-to to make a single purpose utility without any prior noesis or understanding. Or they may have used some idiot proof linux distro designed for a specific purpose like Untangle or ClearOS, once more with no understanding of anything underlying.

    Was this post helpful? thumb_up thumb_down

  • We do a off-white flake of file uploading and transferring to our application servers here ;)  Typically, if a procedure needs to upload to our production surroundings, we use SCP with a defended business relationship with a password-less SSH key.  The primal is restricted within the authorized_keys file to running a single command.  That command is really a perl script which checks that the incoming commands from the upload system are 1) allowed two) formatted correctly (proper number of arguments) and 3) targeting the correct directory.  If any of these checks fail, the upload login is rejected.

    From there, it is a basic SCP of the parcel (file) to the destination host.  If you want, I tin post sample code showing how this works.

    Was this mail helpful? thumb_up thumb_down

  • Alex3031 wrote:

    Depends some people inherited Linux servers and have almost no noesis, or they followed some how-to to make a single purpose utility without whatsoever prior knowledge or understanding. Or they may have used some idiot proof linux distro designed for a specific purpose similar Untangle or ClearOS, again with no understanding of anything underlying.

    deplorable, but true. fair enough.

    Was this post helpful? thumb_up thumb_down

  • Thanks lot. Time to put it for exam.

    Was this post helpful? thumb_up thumb_down

  • Rdavid wrote:

    The file acts more like a log. My Linux System will be having that file in a binder, but I desire to upload the file to my web server automatically using beat out script and cron. I accept looked around and am notwithstanding finding difficulties to achieve it.

    But upload HOW?  Web servers don't generically have put requests for uploads.  All of the of import details are lacking.  I exercise what you are describing every day but I don't know what protocols you lot are using or what web site information technology is then lack all necessary context.

    You lot can just apply curlicue in crontab to achieve this if you lot know the URL.

    Was this post helpful? thumb_up thumb_down

  • banzai2587 wrote:

    this is pretty fishy imho, running linux server implies basic knowledge of how some of the stuff works.  My short list of what can exist used to exercise the trick.

    rsync

    scp

    ssh

    sftp

    nc

    curlicue

    ftp

    Not really.  And he might be a Linux guru but the issue at hand is not Linux but the web host.  The Linux aspect of the question is niggling.  All of the important $.25 are knowing how the spider web host behaves and what it offers.

    Was this postal service helpful? thumb_up thumb_down

  • Scott Alan Miller wrote:

    banzai2587 wrote:

    this is pretty fishy imho, running linux server implies basic noesis of how some of the stuff works.  My brusque list of what can be used to do the play tricks.

    rsync

    scp

    ssh

    sftp

    nc

    gyre

    ftp

    Non really.  And he might be a Linux guru but the issue at hand is not Linux only the web host.  The Linux attribute of the question is trivial.  All of the important $.25 are knowing how the web host behaves and what it offers.

    I mean this in the kindest way, but if he was a Linux guru I would hope he would know or could have found out what methods his web host provided.

    Was this post helpful? thumb_up thumb_down

  • I don't think he necessarily implied that he was wanting to upload the file via HTTP.  What I got was, he wants to simply transfer a file from one server to his web server.

    Was this mail service helpful? thumb_up thumb_down

  • Kris (Spiceworks) wrote:

    I don't think he necessarily unsaid that he was wanting to upload the file via HTTP.  What I got was, he wants to but transfer a file from 1 server to his web server.

    I know, but the only thing we know that it is, is a web server.  Might be running Plan9 and accept no open port but HTTP.  Nosotros lack all information as to the system in question.

    Was this post helpful? thumb_up thumb_down

  • Alex3031 wrote:

    Scott Alan Miller wrote:

    banzai2587 wrote:

    this is pretty fishy imho, running linux server implies basic knowledge of how some of the stuff works.  My short listing of what can exist used to do the trick.

    rsync

    scp

    ssh

    sftp

    nc

    curlicue

    ftp

    Not really.  And he might be a Linux guru only the issue at hand is not Linux but the web host.  The Linux aspect of the question is trivial.  All of the important bits are knowing how the web host behaves and what it offers.

    I mean this in the kindest way, but if he was a Linux guru I would hope he would know or could have found out what methods his web host provided.

    Well certainly.  I'yard just saying.

    Was this mail helpful? thumb_up thumb_down

  • Sorry for the late replies. I was away. Thank you for the replies. I accept managed to discover out a solution. Sorry for the incomplete inquiry.

    Was this post helpful? thumb_up thumb_down

  • While yous may not accept used a solution posted here, could you mark a Best Answer and maybe whatsoever helpful answers from the thread? Thank you.

    Was this postal service helpful? thumb_up thumb_down

  • Same kind of problem as the original question posted by Network Overlord.
    I am trying to automate a certificate flow process with a high intensity in my company. The file server is openSuse, works fine, I made it then people will scan the documents and they will be sorted in the file server with directories with specific names, which names have to be taken as cardinal, to where to place the files contained within. Files will exist placed on a remote web server (don't think it is a big problem, I accept to exist able to finalize the procedure based on experience with moving the files locally) Will be uploaded to the destination folders with the respective binder name. IDK if it is like shooting fish in a barrel to make such system, never did information technology, right now exploring the options. I am not good with Shell script, my powers are on PHP. Could yous at to the lowest degree tell me am I on the right forum? :> Cheers in accelerate and best of luck!
    -Atakan-

    Was this post helpful? thumb_up thumb_down

  • Atakan you probably would be best served by starting a new thread for assistance.

    Was this post helpful? thumb_up thumb_down

  • Scott Alan Miller

  • Hullo guys sorry to crash in on the forum just I take been looking if this is possible for ages on the internet.

    Would this be what I demand to do... let me explicate my situation.

    I accept a script  ( php, bootstrap, MySQL ,jquery etc.) it'due south an online web designer.

    How ever at the present clients can only download the whole files ( once designed on the wing) to their

    pc then they accept to ftp up to their own servers. Cipher special needed merely like designing a website/folio and uploading to our servers.

    What im later is to prepare upwardly a split folder on my server to allow clients to PUBLISH to that binder automatically. This volition then exist a live website but under my sub folder say. ( with say their website name auto created : like www.maindomain.com/newclient1/

    then the side by side would exist www.maindomain.com/newclient2/ )

    If not and then sorry to ask just if some 1 could please help me out I would be well-nigh grateful

    many thanks

    Craig

    Was this post helpful? thumb_up thumb_down

  • You hateful just a scripted RSYNC job?

    You'll go the best response past posting in your own thread, this one is already airtight out and in that location is just ane question (the first postal service) per thread.

    Was this post helpful? thumb_up thumb_down

  • Thanks Scott I will exercise that

    cheers

    Craig

    Was this postal service helpful? thumb_up thumb_down

  • You lot'll probably become lots of responses in a fresh thread.  Old ones don't become much visibility even if there are a lot of people on them.

    Was this mail service helpful? thumb_up thumb_down

Read these next...

  • Spark! Pro Series - April 15th, 2022 **Edited**

    Spark! Pro Serial - April 15th, 2022 **Edited**

    Spiceworks Originals

    April 15th is i of those days in history that took a giant cost on humanity. This twelvemonth it happens to fall on Practiced Friday, which was the twenty-four hour period that Jesus was crucified and then buried, to rise on Easter Sunday. But, at that place is so much more in the way of loss...

  • Snap! Chrome updates, Atlassian outage, crypto heist, & the debut of Apple II

    Snap! Chrome updates, Atlassian outage, crypto heist, & the debut of Apple Ii

    Spiceworks Originals

    Your daily dose of tech news, in brief. Welcome to Friday, everyone! The weekend is already effectually the corner... but I'1000 jealous considering I know information technology has already begun for many of yous (and I hope you're having an amazing one). You need to hear this...

  • OTA Rewind: 4/13/22 - Making Virtualization a Vacation with Scale Computing

    OTA Rewind: 4/thirteen/22 - Making Virtualization a Vacation with Scale Computing

    Spiceworks Goggle box

    It was the first On The Air of this year and the beginning in-person OTA in two years!! In this episode "Making Virtualization a Vacation" nosotros explore how to save time managing a hyperconverged infrastructure with Dus...

  • No Internet Connection on Replaced Switch unless old Switch is also connected

    No Internet Connection on Replaced Switch unless former Switch is also continued

    Networking

    Hello And cheers to anyone who is taking the time and reading my Post <3I accept a weird problem, so bare with me. I have been giving the task to supervene upon about xi Switches from Managed Cisco SGE Models to Managed Netgear S3300. The quondam Cisco Switches had...

  • What is your experience with InTune and Modern Workplace?

    What is your feel with InTune and Modern Workplace?

    Deject Computing & SaaS

    Hi Spiceheads!I merely wanted an general overview of the community's experience / success with InTune and more specifically Modern Workplace.  Information technology seems we're moving toward that zero-touch on philosophy with automated software installs (bye bye SCCM) and automa...

dustinprighorky84.blogspot.com

Source: https://community.spiceworks.com/topic/294886-using-a-shell-script-to-automatically-upload-a-file-to-a-web-server-in-linux

0 Response to "How to Upload Scripting Files to Web Server"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel