[opensuse] writing a crontab and don't know where to put it
I have a script that I need to make into a crontab. It's to autoupdate f-prot anti virus. I looked at the man-pages and I'm not sure how to put the file in the proper place. I'm not even sure if I should use YaST2 sysconfig editor, the konsole or what to write the thing. I sure would appreciate some guidance here, please. Cheers, Dwian -- Dwain Alford P.O. Box 145 Winfield, Alabama 35594 telephone: 205.487.2570 cellphone: 205.495.5619 "The artist may use any form which his expression demands; for his inner impulse must find suitable expression." Wassily Kandinsky, "Concerning The Spiritual In Art"
Dwain, On Tue, 2007-04-10 at 01:05 -0500, dwain wrote:
I have a script that I need to make into a crontab. It's to autoupdate f-prot anti virus. I looked at the man-pages and I'm not sure how to put the file in the proper place. I'm not even sure if I should use YaST2 sysconfig editor, the konsole or what to write the thing.
There are plenty of ways to do this... Here's a few suggestions; If this is for a specific user, run crontab -e from a terminal. If it's system wide, either run crontab -e as root from a terminal or chuck the script in /etc/cron.daily Don't forget to make it executable! You could even have it check for updates when you get a network connection. Have a look at the scripts in /etc/NetworkManager/dispatcher.d
I sure would appreciate some guidance here, please.
HTH
Cheers, Dwian
Cheers, Magnus -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 10 April 2007 01:15, Magnus Boman wrote:
Don't forget to make it executable!
How do I do this? Here's the script: su crontab-e 27 4,16 * * * /usr/local/f-prot/tools/check-updates.pl -cron -quiet Do you see any flaws? How do I save it to cron.daily? This is such an adjustment for me, but I'm loving every minute of it. Cheers, Dwain -- Dwain Alford P.O. Box 145 Winfield, Alabama 35594 telephone: 205.487.2570 cellphone: 205.495.5619 "The artist may use any form which his expression demands; for his inner impulse must find suitable expression." Wassily Kandinsky, "Concerning The Spiritual In Art"
Dwain, On Tue, 2007-04-10 at 01:58 -0500, dwain wrote:
On Tuesday 10 April 2007 01:15, Magnus Boman wrote:
Don't forget to make it executable!
How do I do this?
chmod 700 /usr/local/f-prot/tools/check-updates.pl The 7 in 700 above means flag it to RWX. (Read/Write/eXecutable) by the owner and no writes to anyone else. When you change your files, you add the numbers as follows R = 4 W = 2 X = 1 4+2+1 = 7 The second 0 is for the group that owns the file, they will have no wrights The third 0 is for everybody else, and they wont have any rights either. But if this is supplied by f-prot, it's probably executable already. Check it with ls -l /usr/local/f-prot/tools/check-updates.pl
Here's the script:
su crontab-e 27 4,16 * * * /usr/local/f-prot/tools/check-updates.pl -cron -quiet
Do you see any flaws? How do I save it to cron.daily?
That script will run 4.27 and 16.27 everyday. What you can do to put it in cron.daily is; ln -s /usr/local/f-prot/tools/check-updates.pl /etc/cron.daily/ But you don't have to do that if you already have it in root's crontab (as you show above). If you want to put it in cron.daily, remove the line from crontab -e.
This is such an adjustment for me, but I'm loving every minute of it.
Yhea, it's good fun to be able to control the OS instead of the OS controlling you :-)
Cheers, Dwain
Cheers, Magnus -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Tuesday 2007-04-10 at 01:58 -0500, dwain wrote:
On Tuesday 10 April 2007 01:15, Magnus Boman wrote:
Don't forget to make it executable!
How do I do this?
Do not make the crontab entry executable! You create it by using "crontab - -e" and that's all there is to it. That command knows where to save it and how. By the way, if you don't like the default editor (vi) you can change it to use another one you prefer; for instance: localhost:~ # EDITOR=/usr/bin/mcedit crontab -e or make the change permanent editing ".bashrc": export EDITOR=/usr/bin/mcedit or export EDITOR=/usr/bin/jstar Thus you will not have to ask here how to save the file, mcedit has a menu. ;-)
Do you see any flaws? How do I save it to cron.daily?
That's a totally different approach: either use "crontab -e", or use this one, not both. You create an script in the directory /etc/cron.daily/ as root, and it will be executed once a day (at an hour of the system choice, not yours (kind of)). This is an script and has to be executable. You can study the scripts already there. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFGHE6htTMYHG2NR9URAvMDAJ9e/0u+Gela6Zv0Ez3urTlPm/tkWQCdF4W5 Ct+apoDqhxBtIRdNURuMN2E= =s7e6 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue 10 Apr 2007 06:15, Magnus Boman wrote:
There are plenty of ways to do this...
you can make it as an executable file, called "rootcron" in directory: /var/spool/cron/tabs then, execute : /var/spool/cron/tabs/crontab rootcron . . . and your executable file rootcron will be installed as your new crontab named "root" in the file : /var/spool/cron/tabs/root [ I believe :) ] cheers -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Monday 09 April 2007, riccardo35@gmail.com wrote:
On Tue 10 Apr 2007 06:15, Magnus Boman wrote:
There are plenty of ways to do this...
you can make it as an executable file, called "rootcron" in directory:
/var/spool/cron/tabs
then, execute :
/var/spool/cron/tabs/crontab rootcron
. . . and your executable file rootcron will be installed as your new crontab named "root" in the file :
/var/spool/cron/tabs/root
[ I believe :) ]
There is no reason to make it executable. Any text file will do. It can be located anywhere. I suggest you read man crontab -- _____________________________________ John Andersen
John Andersen wrote:
On Monday 09 April 2007, riccardo35@gmail.com wrote:
On Tue 10 Apr 2007 06:15, Magnus Boman wrote:
There are plenty of ways to do this...
you can make it as an executable file, called "rootcron" in directory:
/var/spool/cron/tabs
then, execute :
/var/spool/cron/tabs/crontab rootcron
. . . and your executable file rootcron will be installed as your new crontab named "root" in the file :
/var/spool/cron/tabs/root
[ I believe :) ]
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ... You do have a choice.... the //etc/cron.hourly, /etc/cron.daily and /etc/cron.monthly directory contain system wide root jobs that are executed at the indicated times. You can ensure a script is run a given interval merely by placing the executable script in the relevant directory.... The more complex option is to create a crontab table file for a user account and activating it with the crontab command....
I suggest you read man crontab
agreed..
On Tue, 2007-04-10 at 09:54 +0100, G.T.Smith wrote:
John Andersen wrote:
On Monday 09 April 2007, riccardo35@gmail.com wrote:
On Tue 10 Apr 2007 06:15, Magnus Boman wrote:
There are plenty of ways to do this...
you can make it as an executable file, called "rootcron" in directory:
/var/spool/cron/tabs
then, execute :
/var/spool/cron/tabs/crontab rootcron
. . . and your executable file rootcron will be installed as your new crontab named "root" in the file :
/var/spool/cron/tabs/root
[ I believe :) ]
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
Ehh..? What are you considering "original suggestion" here?
You do have a choice.... the //etc/cron.hourly, /etc/cron.daily and /etc/cron.monthly directory contain system wide root jobs that are executed at the indicated times. You can ensure a script is run a given interval merely by placing the executable script in the relevant directory.... The more complex option is to create a crontab table file for a user account and activating it with the crontab command....
I suggest you read man crontab
agreed..
Cheers, Magnus -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Magnus Boman wrote:
On Tue, 2007-04-10 at 09:54 +0100, G.T.Smith wrote:
John Andersen wrote:
[Stuff deleted]
*you can make it as an executable file, called "rootcron" in directory:
* /var/spool/cron/tabs
*then, execute :
* /var/spool/cron/tabs/crontab rootcron
* . . . and your executable file rootcron will be installed as your new *crontab named "root" in the file :
* /var/spool/cron/tabs/root
*[ I believe :) ]
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
Ehh..? What are you considering "original suggestion" here?
The marked(*) section ...to expand ... the /var/spool/cron/tabs directory is where crontab normally stores the cron tables for individual users, which is correct to a point. (there is also the system crontab .. /etc/crontab. You do not need put stuff there directly. /var/spool/cron/tabs/crontab <file> command is a nonsense, the /var/spool directory structure is a spool directory and should not contain executables and the command will not run anyway.... rootcron should be a cron table definition not the script to be executed ...
Cheers, Magnus
On Tuesday 10 April 2007, G.T.Smith wrote:
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
No the root cron file is not executable. Nor it is executed. It is merely read by cron and the tasks listed therein are performed per schedule. man cron man crontab -- _____________________________________ John Andersen -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 10 April 2007 20:55, John Andersen wrote:
On Tuesday 10 April 2007, G.T.Smith wrote:
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
No the root cron file is not executable. Nor it is executed. It is merely read by cron and the tasks listed therein are performed per schedule.
man cron man crontab
I just signed in as root and did crontab -e and there was the code. it says it's in the tmp/crontab directory. Is this correct? BTW, thanks for the information. Dwain -- Dwain Alford P.O. Box 145 Winfield, Alabama 35594 telephone: 205.487.2570 cellphone: 205.495.5619 "The artist may use any form which his expression demands; for his inner impulse must find suitable expression." Wassily Kandinsky, "Concerning The Spiritual In Art"
dwain wrote:
On Tuesday 10 April 2007 20:55, John Andersen wrote:
On Tuesday 10 April 2007, G.T.Smith wrote:
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
No the root cron file is not executable. Nor it is executed. It is merely read by cron and the tasks listed therein are performed per schedule.
man cron man crontab
I just signed in as root and did crontab -e and there was the code. it says it's in the tmp/crontab directory. Is this correct?
BTW, thanks for the information.
Dwain
It's there until you actually save the changes. And it's the semi-colon key, not the colon as I said (my mistake). Hit shift, then the colon, semi-colon, and it will save the file. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 10 April 2007 21:18, Pueblo Native wrote:
dwain wrote:
On Tuesday 10 April 2007 20:55, John Andersen wrote:
On Tuesday 10 April 2007, G.T.Smith wrote:
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
No the root cron file is not executable. Nor it is executed. It is merely read by cron and the tasks listed therein are performed per schedule.
man cron man crontab
I just signed in as root and did crontab -e and there was the code. it says it's in the tmp/crontab directory. Is this correct?
BTW, thanks for the information.
Dwain
It's there until you actually save the changes. And it's the semi-colon key, not the colon as I said (my mistake). Hit shift, then the colon, semi-colon, and it will save the file.
How do I edit this file to be able to save it as you say? Would you also please write the save command? -- Dwain Alford P.O. Box 145 Winfield, Alabama 35594 telephone: 205.487.2570 cellphone: 205.495.5619 "The artist may use any form which his expression demands; for his inner impulse must find suitable expression." Wassily Kandinsky, "Concerning The Spiritual In Art"
John Andersen wrote:
On Tuesday 10 April 2007, G.T.Smith wrote:
There is no reason to make it executable. Any text file will do. It can be located anywhere.
Surely some mistake here, the root cron file in the example would have to executed to so needs execute rights :-) ... To be honest reply is a bit ambiguous..., but the original suggestion is wildly off the mark ...
No the root cron file is not executable. Nor it is executed. It is merely read by cron and the tasks listed therein are performed per schedule.
man cron man crontab
The manpage for cron is strictly speaking inaccurate for the SuSE distribution. There are two sub directories under /var/spool/cron. /var/spool/cron/lastrun and /var/spool/cron/tabs. It is in the latter that the table files are kept (not /var/spool/cron directly as the manpage implies). The former is used by run-crons to store the time directory locks. BTW a useful way of tweaking when these are run is to touch the relevant lock file. Off course, one should not edit the contents of /var/log/cron/tabs directly :-) crontab should always be used. Actually, for the original question it would possibly be best to add the task to the /etc/crontab file (it is the system crontable). By default it (in SuSE anyway) just runs the run-crons script, but there is no reason one cannot add anything else to it. Personally, I would prefer to use the user crontab for root for operations relevant to the root account as an account rather than the system as whole. To get to manpage describing the format of the crontab file you need to enter... man 5 crontab
Magnus Boman wrote:
Dwain,
On Tue, 2007-04-10 at 01:05 -0500, dwain wrote:
I have a script that I need to make into a crontab. It's to autoupdate f-prot anti virus. I looked at the man-pages and I'm not sure how to put the file in the proper place. I'm not even sure if I should use YaST2 sysconfig editor, the konsole or what to write the thing.
There are plenty of ways to do this... Here's a few suggestions;
If this is for a specific user, run crontab -e from a terminal. If it's system wide, either run crontab -e as root from a terminal or chuck the script in /etc/cron.daily
One important addittion, system wide jobs are also run later if the system was off at the time specified. Regards, Jan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
dwain wrote:
I have a script that I need to make into a crontab. It's to autoupdate f-prot anti virus. I looked at the man-pages and I'm not sure how to put the file in the proper place. I'm not even sure if I should use YaST2 sysconfig editor, the konsole or what to write the thing.
Just for completeness, you could also run kdesu kcron and add it via a graphical cron editor. -- Joe Morris Registered Linux user 231871 running openSUSE 10.2 x86_64 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 10 April 2007 05:10, Joe Morris (NTM) wrote:
dwain wrote:
I have a script that I need to make into a crontab. It's to autoupdate f-prot anti virus. I looked at the man-pages and I'm not sure how to put the file in the proper place. I'm not even sure if I should use YaST2 sysconfig editor, the konsole or what to write the thing.
Just for completeness, you could also run kdesu kcron and add it via a graphical cron editor.
Huh? How? Please elaborate, I'm a babe in arms when it comes to this "programming" stuff. Cheers, Dwain -- Dwain Alford P.O. Box 145 Winfield, Alabama 35594 telephone: 205.487.2570 cellphone: 205.495.5619 "The artist may use any form which his expression demands; for his inner impulse must find suitable expression." Wassily Kandinsky, "Concerning The Spiritual In Art"
dwain wrote:
On Tuesday 10 April 2007 05:10, Joe Morris (NTM) wrote:
dwain wrote:
I have a script that I need to make into a crontab. It's to autoupdate f-prot anti virus. I looked at the man-pages and I'm not sure how to put the file in the proper place. I'm not even sure if I should use YaST2 sysconfig editor, the konsole or what to write the thing. Just for completeness, you could also run kdesu kcron and add it via a graphical cron editor.
Huh? How? Please elaborate, I'm a babe in arms when it comes to this "programming" stuff.
It's not programming stuff - kcron is just a GUI frontend for editing crontab files. So [Alt-F2] to get the Run Command dialog, then type in 'kdesu kcron' to run it as root (kdesu does the 'su' to root). -- Jonathan Arnold (mailto:jdarnold@buddydog.org) Daemon Dancing in the Dark, an Open OS weblog: http://freebsd.amazingdev.com/blog/ UNIX is user-friendly. It's just a bit picky about who its friends are. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (10)
-
Carlos E. R.
-
dwain
-
G.T.Smith
-
Jan Kalcic
-
Joe Morris (NTM)
-
John Andersen
-
Jonathan Arnold
-
Magnus Boman
-
Pueblo Native
-
riccardo35@gmail.com