11-08-2001
crontab options
Guest100,
I used to use only "crontab -e" until I found this way of editing the crontab. It is much safer for you and if you make any mistakes it doesn't corrupt your crontab file.
When you look at the options for the manpage for crontab, the first options is "crontab filename".
My only point about saving the crontab out to a file and editing it is 1) so that you will have a copy of it and 2) when you edit this text file that you just saved out, you can execute "crontab filename" to replace the current crontab with the newly edited one. In addition, it prevents you from making a mistake typing while using "crontab -e".
Step 1
Copy out the crontab to a saved file.
$ crontab -l > somefile
Step 2
edit somefile and make changes.
$ vi somefile
Step 3
copy the newly edited file back into place.
$ crontab somefile
This is the safest way to edit the crontab file so that it doesn't get corrupted.
I work for a very large telecom company and this is the company standard for all platforms: SUN, HPUX, and AIX with several different versions on each platform.
In addition, yes you can go to /usr/spool/cron/crontabs and vi the file in question, edit it and save. The file will be recognized by cron because I have done this as well. I have even cut and pasted from a Word document into a telnet session while vi'ing a file in /usr/spool/cron/crontabs file. And there was no corruption of the file when I saved it and ran cron.
Trust me, all of these things work! Can someone else back me up on this? I am not trying to mess you up, only to help you out.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a server running 5.9 and I'm trying to cron in the following.
00 01 * * 7 cd /data/apache/logs && find . -type f -name "access.*" -mtime +1 -print |xargs rm > /dev/null 2>&1
But I keep get the following error....
00 01 * * 7 cd /data/apache/logs && find . -type f -name "access.*"... (2 Replies)
Discussion started by: Zak
2 Replies
2. Shell Programming and Scripting
HI,
i am working on linux.
i have crontab problem
i wrote a small script and put it in a crontab .
but the script is not running..
i have given following way in crontab -e
02 06 * * * /bin/csh /home/vr_test.csh
but the above script is not running
please rectify my... (26 Replies)
Discussion started by: rajan_ka1
26 Replies
3. UNIX for Dummies Questions & Answers
I'm trying to get crontab to run a script, but to test crontab I tried out a very simple command: `echo bob`
here is my crontab file (I edited it by using `crontab -e`):
-----------------
#!/bin/sh
23 10 * * * echo bob
and at 10:23 every day I get a new message:
in /var/mail/a... (3 Replies)
Discussion started by: cleansing_flame
3 Replies
4. UNIX for Dummies Questions & Answers
i added to my crontab file:
* * * * * echo "hello"
it works, i receive a message into my /var/mail/username
and i receive: bob
in addition to a large text add-on
any help appreciated (1 Reply)
Discussion started by: cleansing_flame
1 Replies
5. UNIX for Advanced & Expert Users
hi all
while using crontab -e im receiving
754 as output
im unable to add a entry in crontab
crontab -l is working fine
OS: sun5.8
can some one please assist me (4 Replies)
Discussion started by: NIMISH AGARWAL
4 Replies
6. Shell Programming and Scripting
Dear All ,
I have .sh script wich has the following inside
getFileName=Listportfolio.txt.`date +'%Y%m%d`
ftp -n 172.10.10.1<<EOF
user xxx xxx
bin
cd /home/gbs/FTP_Script
get /home/gbs/FTP_Script/$getFileName
bye
EOF
EOF
when I run the... (3 Replies)
Discussion started by: habuzahra
3 Replies
7. Shell Programming and Scripting
Hi All,
Am facing an issue while updating the crontab.Getting below error while updating the cron.
cron/tmp.XXXX5fXBR6: No space left on device
crontab: edits left in /tmp/crontab.XXXXEJX5gw
Is there any file where i need to alter using root user so that i can update the cron.
TIA... (9 Replies)
Discussion started by: Ashok_oct22
9 Replies
8. AIX
Hi to all.
Guys, i have a truble with oracle user crontab.
He work if i'm do
0-59 * * * * echo LOL> ~/test.txt
But not work if me set realy norm date
For example
14 17 28 12 * echo LOL> ~/test.txt
In 17:14 28 December .
In log file /var/adm/cron/log nothing....
Please... (3 Replies)
Discussion started by: jess_t03
3 Replies
9. UNIX for Advanced & Expert Users
hi..
i have a program (tf.sh), and i want what it runs automatically with a "lapsus" of 2 hours. (1,3,5,7,9,11,13,15,17,19,21,23 hrs.)
i know what i have to do it using crontab, but i donīt know how to do it.
i have the next idea, but the problem is what it doesnīt run on my server... (11 Replies)
Discussion started by: DebianJ
11 Replies
10. Solaris
hi all
does any on has explanation for this result
bash-3.00$ crontab -e
"/var/tmp/Ex1kayUW" No space left on device
The crontab file was not changed.
bash-3.00$ (2 Replies)
Discussion started by: osmannix
2 Replies
PASSWD(5) Linux Programmer's Manual PASSWD(5)
NAME
passwd - password file
DESCRIPTION
Passwd is a text file, that contains a list of the system's accounts, giving for each account some useful information like user ID, group
ID, home directory, shell, etc. Often, it also contains the encrypted passwords for each account. It should have general read permission
(many utilities, like ls(1) use it to map user IDs to usernames), but write access only for the superuser.
In the good old days there was no great problem with this general read permission. Everybody could read the encrypted passwords, but the
hardware was too slow to crack a well-chosen password, and moreover, the basic assumption used to be that of a friendly user-community.
These days many people run some version of the shadow password suite, where /etc/passwd has asterisks (*) instead of encrypted passwords,
and the encrypted passwords are in /etc/shadow which is readable by the superuser only.
Regardless of whether shadow passwords are used, many sysadmins use an asterisk in the encrypted password field to make sure that this user
can not authenticate him- or herself using a password. (But see the Notes below.)
If you create a new login, first put an asterisk in the password field, then use passwd(1) to set it.
There is one entry per line, and each line has the format:
account:password:UID:GID:GECOS:directory:shell
The field descriptions are:
account the name of the user on the system. It should not contain capital letters.
password the encrypted user password, an asterisk (*), or the letter 'x'. (See pwconv(8) for an explanation of 'x'.)
UID the numerical user ID.
GID the numerical primary group ID for this user.
GECOS This field is optional and only used for informational purposes. Usually, it contains the full username. GECOS means
General Electric Comprehensive Operating System, which has been renamed to GCOS when GE's large systems division was sold
to Honeywell. Dennis Ritchie has reported: "Sometimes we sent printer output or batch jobs to the GCOS machine. The gcos
field in the password file was a place to stash the information for the $IDENTcard. Not elegant."
directory the user's $HOME directory.
shell the program to run at login (if empty, use /bin/sh). If set to a nonexistent executable, the user will be unable to login
through login(1).
FILES
/etc/passwd
NOTES
If you want to create user groups, their GIDs must be equal and there must be an entry in /etc/group, or no group will exist.
If the encrypted password is set to an asterisk, the user will be unable to login using login(1), but may still login using rlogin(1), run
existing processes and initiate new ones through rsh(1), cron(8), at(1), or mail filters, etc. Trying to lock an account by simply chang-
ing the shell field yields the same result and additionally allows the use of su(1).
SEE ALSO
login(1), passwd(1), su(1), getpwent(3), getpwnam(3), group(5), shadow(5)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 1998-01-05 PASSWD(5)