How can I move a file to a webserver every 5 minutes?


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu How can I move a file to a webserver every 5 minutes?
# 8  
Old 07-18-2008
Quote:
Originally Posted by osulinux
Why isn't it a good option?
If the computer is rebooted, it will need to be restarted.

If the script crashes your need to restart it.

If the script hangs you will have to restart it.


If its in cron it will automatically run when needed even if anyov the above happends.
# 9  
Old 07-21-2008
Create a file ".netrc" in the home dir of the user who will be FTPing the files to the webserver. The contents of .netrc file would be the following line:
======================================================
machine webserver_ip_address login username password userpassword
======================================================
The perms set to .netrc will be 400.
Now create the script in that users' home dir as:

#!/bin/bash
FILENAME="filename.txt"
ftp -n <<FEOF
verbose
prompt
bin
put $FILENAME
FEOF

Put it inside cron.

Now well u can definately make it run every 5 mins without putting it in a cron if u make it run as a daemon and also make it available in startup/shutdown scripts. In Linux make the sym link of this script in /etc/rc.d/local dir. That should be all.
# 10  
Old 07-21-2008
One correction here.
Replace ftp -n with ftp web_server_ipaddress
# 11  
Old 07-31-2008
Wouldn't it be better to use RSYNC? It is more secure then ftp. Install it and read the man page to know if it is possible to do a resynchronising of your local directory with that of your server in question every 5 min. Else write a script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

rsync a file as it gets created and after 3 minutes old

- run a backup job - The jobs creates partial files one after the other, about 2 minutes interval. What i want to do is that while the job is still running or while a file was last modified or created 3 minutes ago, the file should be rsync to a remote server untill the last file has been... (4 Replies)
Discussion started by: malaika
4 Replies

2. Shell Programming and Scripting

Check file creation Time minutes and if file older then 5 minutes execute some stuff

Hello all, Info: System RedHat 7.5 I need to create a script that based on the creation time, if the file is older then 5 minutes then execute some stuff, if not exit. I thought to get the creation time and minutes like this. CreationTime=$(stat -c %y /tmp/test.log | awk -F" " '{ print... (3 Replies)
Discussion started by: charli1
3 Replies

3. Shell Programming and Scripting

Grep a log file for the last 5 minutes of contents every 5 minutes

Hi all, System Ubuntu 16.04.3 LTS i have the following log INFO 2019-02-07 15:13:31,099 module.py:700] default: "POST /join/8550614e-3e94-4fa5-9ab2-135eefa69c1b HTTP/1.0" 500 2042 INFO 2019-02-07 15:13:31,569 module.py:700] default: "POST /join/6cb9c452-dcb1-45f3-bcca-e33f5d450105... (15 Replies)
Discussion started by: charli1
15 Replies

4. UNIX for Beginners Questions & Answers

How to convert days hours minutes seconds to minutes?

Hi, please help with below time conversion to minutes. one column values: 2 minutes 16 seconds 420 msec 43 seconds 750 msec 0 days 3 hours 29 minutes 58 seconds 480 msec 11 seconds 150 msec I need output in minutes(total elapsed time in minutes) (2 Replies)
Discussion started by: ramu.badugula
2 Replies

5. Shell Programming and Scripting

Move all .log except those generated in the last 5 minutes

RHEL 5.8 In the directory /u03/pkms/app_logs I have several hundreds of log files as shown below. $ pwd /u03/pkms/app_logs $ ls -alrt *.log | tail -50 -rw-r----- 1 oracle dba 9439232 May 4 13:57 mvtpcem_1_722892404_94157.log -rw-r----- 1 oracle dba 9227264 May 4 13:57... (8 Replies)
Discussion started by: kraljic
8 Replies

6. Shell Programming and Scripting

Stop append to file after 5 minutes

Hi all, I've got a grep command, in which the value (a number) is being appended into a file. Such file will have this output: 100 105 300 204 150 ... ... 120 113 124 This file will continue to append, since the grep line runs every 10 seconds. Is there a way to stop the file... (5 Replies)
Discussion started by: Wizard_1979
5 Replies

7. Shell Programming and Scripting

Find the age of a file in Minutes

KSH: Please lt me know how to find the age of a file in minutes(Based on last modified time). ie, if the file was modified 15 Minutes ago, the output should be 15 (1 Reply)
Discussion started by: hari_anj
1 Replies

8. UNIX for Dummies Questions & Answers

Script to move certain number of files every 10 minutes.

Hi, I need to move a certain number of files every 10 minutes from one folder to another. I have written the script below, however its not working, please advise. #! /bin/ksh start() { mv /test1/$(head -1000 /movetst) /test2/ sleep 600 } stop() { exit } ls ti* >... (1 Reply)
Discussion started by: amitsayshii
1 Replies

9. HP-UX

Issue with setup.hp file for webserver

Hi All, I have an issue in writing the shell script to install a webserver on UNIX system. My shell script look something like this. ------------------------------------------------------------ echo "start of the script" #! /bin/sh cd /home/path echo | setup.hp -is:javaconsole -console... (1 Reply)
Discussion started by: vishalm
1 Replies

10. Shell Programming and Scripting

Convert minutes to hours, minutes, seconds

How would you convert lets say a 1000 minutes to hours, minutes, seconds (1 Reply)
Discussion started by: Vozx
1 Replies
Login or Register to Ask a Question