Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a dedicated server which runs on Operating system Mandrake Linux 5.2. This server is located in India. I have another web server which is located in NewYork.
There are some files which gets created on indian server everyday and which i need to move to my newyork server on daily basis.
In order to get this done. i m using this command in indian server.
1) First i want to automate this command to get executed everyday at one given time so that i dont have to re run it manually.
2) Once this command is done copying the data i should be able to run another command which deletes the logs from Indian server so that new logs can be created. ( Actually the first command moves the logs )
1. The environment of CRON is very limited, the PATH is usually /bin:/usr/bin. For this reason is better to use absolute paths for every command in crontab and in the crontab script. Furthermore, when the cron job is executed it will start operations from the user's home directory, so that it's better to use absolute path even for regular files.
2. To debug a cron job, it's convenient to redirect the standard error and the standard output of the job to a file. If not redirected, the cron daemon sends them to the user's mail.
Try to write down your own crontab and feel free to ask if you encounter some specific problem.
1. The environment of CRON is very limited, the PATH is usually /bin:/usr/bin. For this reason is better to use absolute paths for every command in crontab and in the crontab script. Furthermore, when the cron job is executed it will start operations from the user's home directory, so that it's better to use absolute path even for regular files.
2. To debug a cron job, it's convenient to redirect the standard error and the standard output of the job to a file. If not redirected, the cron daemon sends them to the user's mail.
Try to write down your own crontab and feel free to ask if you encounter some specific problem.
Thanks a lot!
Let me create a cron job first and then i will share it with you.
Thanks,
I have a dedicated server which runs on Operating system Mandrake Linux 5.2. This server is located in India. I have another web server which is located in NewYork.
There are some files which gets created on indian server everyday and which i need to move to my newyork server on daily basis.
In order to get this done. i m using this command in indian server.
1) First i want to automate this command to get executed everyday at one given time so that i dont have to re run it manually.
2) Once this command is done copying the data i should be able to run another command which deletes the logs from Indian server so that new logs can be created. ( Actually the first command moves the logs )
Thanks for the help
Instead of ncftpput, you can also try rsync with the --delete option. Take a look at the man page for rsync, that may provide an easier way to remove the logs...
Instead of ncftpput, you can also try rsync with the --delete option. Take a look at the man page for rsync, that may provide an easier way to remove the logs...
Thank you the reply.
I tried using this command to use rsync
[root@game1 /]# rsync -az --progress --size-only /27024/orangebox/cstrike/warmod/* ftp.dummy.com:/home/cryfre/public_html/scrim1
ssh: connect to host ftp.dummy.com port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(463) [sender=2.6.8]
I get this error message. Then i spoke to my new year data center guy who provides me the webserver, he told me i dont have ssh putty in my account , neither it can be enabled.
Is there a way i can run the same command without using ssh? If yes, then can someone please modify the same command
1) Without SSH
2) Include that delete option which deletes after the files have been moved.
I am very new to linux servers. Hope fully someone can help.
rsync can't connect through the FTP protocol, hence you have to stick with some ftp client. I don't know anything about the ncftp tool, but another versatile software is lftp. It comes with the -E option to delete source files after successful transfers. Actually I've never tried this option, anyway it would be safer to keep a backup copy of the original files during your test sessions. The man page of lftp states it's a dangerous option for obvious reasons (indeed any deleting command is potentially dangerous).
I've just looked at the man page of ncftpput: there is a similar option -DD (delete local file after successfully uploading it). If you're more experienced with this tool, you can stick with it. Hope this helps.
Just out of curiosity, did you successfully set up the cron job?
rsync can't connect through the FTP protocol, hence you have to stick with some ftp client. I don't know anything about the ncftp tool, but another versatile software is lftp. It comes with the -E option to delete source files after successful transfers. Actually I've never tried this option, anyway it would be safer to keep a backup copy of the original files during your test sessions. The man page of lftp states it's a dangerous option for obvious reasons (indeed any deleting command is potentially dangerous).
I've just looked at the man page of ncftpput: there is a similar option -DD (delete local file after successfully uploading it). If you're more experienced with this tool, you can stick with it. Hope this helps.
Just out of curiosity, did you successfully set up the cron job?
Thank you very much for this -DD option. Now my sync is all set. Though its manual at this point.
But hopefully i will dig more for cron job to schedule it on daily basis.
Nope. i dont have any luck with cron job as such. The reason because when i execute this command it asks fr my ftp password. Which i have to manually put in.
Any suggestions, how can i schedule this command at everyday 4 am + passwords get entered itself.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.