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
GIT-TAR-TREE(1) 						    Git Manual							   GIT-TAR-TREE(1)

NAME
git-tar-tree - Create a tar archive of the files in the named tree object SYNOPSIS
git tar-tree [--remote=<repo>] <tree-ish> [ <base> ] DESCRIPTION
THIS COMMAND IS DEPRECATED. Use git archive with --format=tar option instead (and move the <base> argument to --prefix=base/). Creates a tar archive containing the tree structure for the named tree. When <base> is specified it is added as a leading path to the files in the generated tar archive. git tar-tree behaves differently when given a tree ID versus when given a commit ID or tag ID. In the first case the current time is used as modification time of each file in the archive. In the latter case the commit time as recorded in the referenced commit object is used instead. Additionally the commit ID is stored in a global extended pax header. It can be extracted using git get-tar-commit-id. OPTIONS
<tree-ish> The tree or commit to produce tar archive for. If it is the object name of a commit object. <base> Leading path to the files in the resulting tar archive. --remote=<repo> Instead of making a tar archive from local repository, retrieve a tar archive from a remote repository. CONFIGURATION
tar.umask This variable can be used to restrict the permission bits of tar archive entries. The default is 0002, which turns off the world write bit. The special value "user" indicates that the archiving user's umask will be used instead. See umask(2) for details. EXAMPLES
git tar-tree HEAD junk | (cd /var/tmp/ && tar xf -) Create a tar archive that contains the contents of the latest commit on the current branch, and extracts it in /var/tmp/junk directory. git tar-tree v1.4.0 git-1.4.0 | gzip >git-1.4.0.tar.gz Create a tarball for v1.4.0 release. git tar-tree v1.4.0^{tree} git-1.4.0 | gzip >git-1.4.0.tar.gz Create a tarball for v1.4.0 release, but without a global extended pax header. git tar-tree --remote=example.com:git.git v1.4.0 >git-1.4.0.tar Get a tarball v1.4.0 from example.com. git tar-tree HEAD:Documentation/ git-docs > git-1.4.0-docs.tar Put everything in the current head's Documentation/ directory into git-1.4.0-docs.tar, with the prefix git-docs/. GIT
Part of the git(1) suite Git 1.8.3.1 06/10/2014 GIT-TAR-TREE(1)
All times are GMT -4. The time now is 12:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy