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.
one addition to vukomir's response: each user has a crontab. so, doing
sudo crontab -l
will show you root's crontab. you can also have your own crontab if you want.
To see what crontabs are currently running on your system, you can open a terminal and run:
sudo crontab -l
To edit the list of cronjobs you can run:
sudo crontab -e
ex:
* * * * * /bin/execute/this/script.sh
As you can see there are 5 stars. The stars represent different date parts in the following order:
minute (from 0 to 59)
hour (from 0 to 23)
day of month (from 1 to 31)
month (from 1 to 12)
day of week (from 0 to 6) (0=Sunday)
Hi, thank you very much to all of you for you helping hands, however, now there is a problem is case of ftp command, it is not working i.e. I want to backup(copy) my Oracle .dmp files from my Sun Solaris Server to RHEL Server I wrote the following codes in a .sh file:
ftp 192.9.1.33
backup
backup
cd /data3/export/hpcl
lcd /data3/Bropts_dbk
prompt
bin
hash
mget *.dmp
bye
exit 0
and I want to schedule my backup. How is it possible!!!!
Hi, thank you very much to all of you for you helping hands, however, now there is a problem is case of ftp command, it is not working i.e. I want to backup(copy) my Oracle .dmp files from my Sun Solaris Server to RHEL Server I wrote the following codes in a .sh file:
Code:
ftp 192.9.1.33
backup
backup
cd /data3/export/hpcl
lcd /data3/Bropts_dbk
prompt
bin
hash
mget *.dmp
bye
exit 0
and I want to schedule my backup. How is it possible!!!!
Well, those 'codes' aren't going to work. Have you tried to run that from a command-line first??? Unless your script can work from the command line, it won't work through cron. So fix that first..a hint, here: look at expect, since your script (as written above) will fail on line 2, because as soon as it forks into the FTP command, processing of the SHELL SCRIPT will stop. So, your user ID/password won't get written, other commands won't work, etc. Expect can automate this task, but again, test the script from the command line first.
On an related note...FTP isn't the best tool to use for the job anymore. SCP or SFTP are more secure, and support key-exchange logins, meaning you don't need to supply a password, which makes things easy to script.
Well, those 'codes' aren't going to work. Have you tried to run that from a command-line first??? Unless your script can work from the command line, it won't work through cron. So fix that first..a hint, here: look at expect, since your script (as written above) will fail on line 2, because as soon as it forks into the FTP command, processing of the SHELL SCRIPT will stop. So, your user ID/password won't get written, other commands won't work, etc. Expect can automate this task, but again, test the script from the command line first.
On an related note...FTP isn't the best tool to use for the job anymore. SCP or SFTP are more secure, and support key-exchange logins, meaning you don't need to supply a password, which makes things easy to script.
Well you are right, it is failing in command line. Can you give me an example of SFTP command for transferring my data from one server to other, as shown in my ftp code you can understand what I wanted to do. So please help me as I am not familiar with SFTP.
Well you are right, it is failing in command line. Can you give me an example of SFTP command for transferring my data from one server to other, as shown in my ftp code you can understand what I wanted to do. So please help me as I am not familiar with SFTP.
Then the best thing you can do is to read the man page for it, since it'll explain how to use it.
A simple command-line is
Code:
sftp <user id>@<ip address of remote machine>
but again, SCP is also an option, and easier to script for:
If you have your keys swapped, you won't need to put in a password, and this will easily run automatically. One catch is that you will need to either run this in a USER crontab (not roots), or specify a users identification on the command line, if you do run it under root's crontab.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.