Sponsored Content
Full Discussion: Crontab - URGENT pls
Top Forums UNIX for Dummies Questions & Answers Crontab - URGENT pls Post 6768 by LivinFree on Wednesday 12th of September 2001 07:01:53 AM
Old 09-12-2001
Depending on your user base (are all of you privelaged-type users, or do you have a lot of "regular" users on your system?), you could do a few things.

Number one, I'd (personally want to) place your commands into a script - just execute the script from cron. That way it'll be much easier to handle the jobs efficiently, and to include a little error handling as well. You could write anything in the script you wanted, including displaying a warning in the MOTD upon backup failure, mailing out to certain users, creating a log file, etc, etc, etc... Besides, if you run the script from cron, as opposed to the command itself, it will be much easier to update and change in the future.

Code:
#!/bin/sh
mv /etc/motd /etc/motd.bk
cat << EOF > /etc/motd
************************
There is a system backup in progress!
Please allow this to complete before
Modifying any of your files!
************************
EOF
wall << EOF
There is a system backup starting in one minute!
Please save all of your work now, and please
refrain from modifying any files until the back
is complete!
EOF
# Give them a few extra seconds
sleep 75 
echo "Start time: `date`" > /var/tmp/tar.log
tar cAuvf /dev/rmt/0m /home > /var/tmp/tar.log 2>&1 ; \
     chmod 600 /var/tmp/tar.log
mv /etc/motd.bk /etc/motd
wall << EOF
The backup of your home direcories is now complete!
Thank you for your patience.
EOF
echo "Stop time: `date`" >> /var/tmp/tar.log

Now, if you want that much extra debugging, at the top of the script, right under "#!/bin/sh", insert a line like this one:
set -x. If you do this, it also might be a good idea to redirect the entire script output to a different file:
30 2 * * * /path/to/my/fake/script.sh >> /var/tmp/tar-debug.log 2>&1

Please do not use the script above in a production environment, because I just made it up right now - instead hopefully you can grab some ideas out of it and build one that suits your needs - just keep in mind that the logs (both the tar -v output and the set -x output) will help you immensly!

Hope that helps!

Last edited by LivinFree; 09-12-2001 at 08:06 AM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

pls help on crontab

how to schedule shellscripts using cron tab (2 Replies)
Discussion started by: ss4u
2 Replies

2. Shell Programming and Scripting

Pls Help.. Really Urgent

Hi, I am creating a pipe in a directory $HOME/pipes. The pipename should be L${PROGNAME}. Whenever i embed these lines in shell script, i get an error mkfifo: No such file or directory. I am creating a pipe with the key word mkfifo $HOME/pipes/L${PROGNAME}. Please help me how to get... (5 Replies)
Discussion started by: raghavan.aero
5 Replies

3. Solaris

lex on solaris??? (urgent, pls!!!)

Hi everyone, I would like to know how to compile and run lex programs on solaris 10. the conventional way is $ lex <name.l> $ cc lex.yy.c -ll $ ./a.out but while trying to execute the 2nd command :i get a reference saying that the command is old or that main is not supported... Hence... (1 Reply)
Discussion started by: wrapster
1 Replies

4. Shell Programming and Scripting

If not working...pls help:URGENT

Following is d code snipet #!/bin/ksh retVal=`sqlplus -s user/passwd\@oracle_sid <<EOF SET SERVEROUTPUT ON SIZE 100000 DECLARE STATUS_VALUE VARCHAR2(1); BEGIN SELECT temp1 INTO STATUS_VALUE FROM sai; DBMS_OUTPUT.PUT_LINE(STATUS_VALUE); END; / exit; EOF` echo "Return Value... (4 Replies)
Discussion started by: sainathdeg
4 Replies

5. UNIX for Dummies Questions & Answers

URGENT :pls help

Following is d code snipet #!/bin/ksh retVal=`sqlplus -s user/passwd\@oracle_sid <<EOF SET SERVEROUTPUT ON SIZE 100000 DECLARE STATUS_VALUE VARCHAR2(1); BEGIN SELECT temp1 INTO STATUS_VALUE FROM sai; DBMS_OUTPUT.PUT_LINE(STATUS_VALUE); END; / exit; EOF` echo "Return Value... (2 Replies)
Discussion started by: sainathdeg
2 Replies

6. Shell Programming and Scripting

Pls Help me.. soon. Very urgent

I have downloaded the Putty SSH configuration. I have entered my Host name as illinois.engr.sjsu.edu and i am trying to save that. But i am unable to save. Also i opened the session and entered my log in name But it says using keyboard interactive authentication.I am not able to get into $ ... (2 Replies)
Discussion started by: VamsiVasili
2 Replies

7. Shell Programming and Scripting

pls help me very urgent

will post again (1 Reply)
Discussion started by: revertback
1 Replies

8. Shell Programming and Scripting

Help Me Pls Its Urgent!!!!!!!!!!!!!!!!

Hi, These are the text file I have //input1.txt// cd dir1/dir2/pg1.txt cd dir3/dir4/pg2.txt cd dir88/dir5/pg4.txt cd dir7/dir6/pg5.txt cd dir8/dir9/pg7.txt And each text file has some text. Now I have to write a shell script which reads input1.txt and changes the directory as shown... (1 Reply)
Discussion started by: bhavanabahety
1 Replies
FAXCRON(8)						      System Manager's Manual							FAXCRON(8)

NAME
faxcron - HylaFAX routine maintenance script SYNOPSIS
/usr/sbin/faxcron [ -n ] [ -l lastrun ] DESCRIPTION
faxcron is a command script that does routine upkeep tasks in a HylaFAX spooling directory hierarchy. This script is intended to be invoked from cron(8) on behalf of the fax user (often the ``fax'' user is uucp) once a day, with the standard output sent by mail to the HylaFAX administrator. For example, the following crontab might be set up for the fax user: 25 23 * * * sh /usr/sbin/faxcron | mail FaxMaster The faxcron script does the following work: o report statistics for facsimile transmitted since the last time faxcron was run. o report statistics for facsimile transmitted in the past week. o report statistics for facsimile received since the last time faxcron was run. o report statistics for facsimile received in the past week. o report any recent calls that failed suspiciously and return the associated trace log; o purge data that is 30 days or older from the remote machine information directory; o delete information that is 30 days or older from session trace log files; o remove files from the tmp directory that are older than 1 day; o remove files in the received facsimile queue that are 7 days or older; o report sites that are currently having jobs rejected; and o force all session log files to be owned by the fax user and kept with protection mode 644. OPTIONS
-n Forces faxcron to run without updating any files. -l lastrun Forces the notion of the last time that faxcron was run to be lastrun. The value of lastrun is a date and time string of the form ``MM/DD/YY HH:MM'' (the date(1) format string ``%D %H:%M''). -info n Set the expiration time for data in the info database to be n days. -log n Set the expiration time for session log data to be n days. -rcv n Set the expiration time for files in the received facsimile queue to be n days. -tmp n Set the expiration time for files in the tmp directory to be n days. -mode m Set the file protection mode for session logs to m (a command line argument to chmod(1)). NOTES
This script requires nawk(1) or gawk(1) and a date (1) program that supports the ``+format'' option. If session logs are to be kept private this script must be modified to filter out sensitive information such as calling card numbers. (It should also be run with ``-mode 0600'' so that session log files are not publicly readable.) FILES
/var/spool/hylafax spooling area /var/spool/hylafax/status/lastrun timestamp of last run /usr/sbin/xferfaxstats for generating transmit statistics /usr/sbin/recvstats for generating receive statistics /var/spool/hylafax/tmp/faxcronXXXX temporary file for truncating session logs /var/spool/hylafax/tmp/faxlogXXXX temporary file for logs of failed calls SEE ALSO
cron(8), faxq(8), faxgetty(8), faxsend(8), xferfaxstats(8), recvstats(8), hylafax-server(5) May 12, 1996 FAXCRON(8)
All times are GMT -4. The time now is 03:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy