[prev in list] [next in list] [prev in thread] [next in thread]
List: sidewinder
Subject: [Sidewinder] Script To Modfy Crontab
From: sidewinder () adeptech ! com
Date: 2005-12-13 20:31:55
Message-ID: 1A78A38FA2CE2A459EE3530159FFBCC5580556 () WPSCV6MN ! OPR ! STATEFARM ! ORG
[Download RAW message or body]
Thank you all for your help.
The solution was much easier than I expected.
#!/bin/sh
/bin/cp /etc/crontab /etc/crontab.bak
/bin/echo "INFO - /etc/crontab HAS BEEN BACKED UP to /etc/crontab.bak"
/bin/echo "
# Comment
0 2 * * SAT root Admn command" >> /etc/crontab
/bin/echo "INFO - /etc/crontab HAS BEEN MODIFIED"
exit 0
Mario Covarrubias Jr., CISSP
-----Original Message-----
From: sidewinder@adeptech.com
Sent: Monday, December 12, 2005 4:38 PM
To: sidewinder@adeptech.com
Subject: Re: [Sidewinder] Scripting Crontab
Hi, all!
Kevin Kadow wrote:
> I need to write a script that will modify /etc/crontab on Sidewinder.
> I'm finding that crontab was designed to be edited from within an
> editor.
Doesn't crontab(1) work on the Sidewinder? It runs a variant of Vixie
cron and /var/cron/tabs exists, so I would give that one a try first.
Besides that - given the necessary Unix access rights and TE context, an
automated job could modify the system wide /etc/crontab. If you can do
it with vi(1), any program can do the same. Simple matter of
programming. man sed, man awk, man sh. I have written numerous shell
scripts to run on the Sidewinder - not that different from any Unix box.
And the documentation explicitely states that cron will reread
/etc/crontab whenever modified - now, isn't that nice? ;-)
To sum it up: on Unix there is no real difference between "editing with
an editor" and "having a shell script do the same".
Get "Unix Power Tools" from O'Reilley ;-))
HTH,
Patrick M. Hausen
Leiter Netzwerke und Sicherheit
--
punkt.de GmbH Internet - Dienstleistungen - Beratung
Vorholzstr. 25 Tel. 0721 9109 -0 Fax: -100
76137 Karlsruhe http://punkt.de
_______________________________________________
Sidewinder mailing list
Sidewinder@adeptech.com
http://mail.adeptech.com/mailman/listinfo/sidewinder
_______________________________________________
Sidewinder mailing list
Sidewinder@adeptech.com
http://mail.adeptech.com/mailman/listinfo/sidewinder
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic