I have a few questions regarding preferred styles in writing cron scripts.

0.  Exit codes.  cron(8) states that "any output produced by a command is sent 
to the user specified in MAILTO...".  In testing simple cases such as:

#!/bin/sh
# bad_script.sh

echo $0
exit 1

I don't see any explicit evidence about the script's exit code being placed 
into the generated email, and neither do the manpages indicate this.  
Ultimately, I have echoed the exit code by brute force in the crontab(5) entry:


*/1 * * * * /home/username/bin/bad_script.sh ; echo "exit code = $?"

Is there a better way?

1.  Script location(s).  In setting up a server with a cron script which logs 
lots of output, hier(7) indicates that /var is the preferred location for 
system log files.  While I can configure this script as a system crontab entry, 
is this a good practice when it comes to security?  Would it be better 
security-wise if the script was configured as a user cron script?  If so, where 
should the logs go?  I assume that opening up the permissions on /var/log is 
not advisable.  Are /usr/bin or /usr/local/bin better ch


2.  Location of associated script configuration file(s).  This is just a 
continuation of the preceding question.  Where should the configuration files 
for such custom cron scripts belong?

3.  Custom log file locations.  Finally, where should the log files of such 
custom cron scripts go?

Yeah, I know it makes most sense to simply decide and move on, but I've 
inherited some systems which have no order whatsoever.  I thought I'd ask here 
before arguing my way through some meetings.  


Thanks!
_______________________________________________
Openbsd-newbies mailing list
[email protected]
http://mailman.theapt.org/listinfo/openbsd-newbies

Reply via email to