LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-22-2007, 04:05 PM   #1
dominant
Member
 
Registered: Jan 2004
Posts: 409

Rep: Reputation: 30
crontab problem in slackware 10.2


Hi all

I cannot set up a job in crontab

When i run #crontab -e
then i write the command

i try to save it. It says that the file save but when i rerun crontab -e i see no changes.

Do you know what is going on?
 
Old 11-22-2007, 04:19 PM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
It's a little hard to say - it sounds like it is not saving at all. Is the default editor for 'crontab -e' vi? If so, are you 100% it is saving successfully - it could be a permission error?

What does crontab -l show (after the edit and save)?

Alternatively you could edit the crontab file directory and restart cron manually.
 
Old 11-22-2007, 04:23 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
As which user do you do this, how did you become that user?
What are the owneships and permissions of
/var/spool/cron/crontabs
and the files therein?



Cheers,
Tink
 
Old 11-22-2007, 05:38 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 164Reputation: 164
I had a similar problem here. When I changed the symlink for vi to point at vim (it was pointing to elvis), I couldn't save my cron jobs either. When I changed it back to elvis, crontab -e started working again. It's probably an environment setting, but I didn't take the time to check it.
 
Old 11-23-2007, 03:17 AM   #5
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
Well, i try to install jobs as root.

after saving the file i see no changes runing #crontab -l

i see something like that "crontab.17667~" in the /var/spool/cron/

any ideas?
 
Old 11-23-2007, 04:36 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
You can edit directly the crontab file at: /var/spool/cron/crontabs/<user>
 
Old 11-23-2007, 05:03 AM   #7
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
I did that but the cron job did not run
 
Old 11-23-2007, 08:43 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Take a look at /var/log/cron to see if you find anything. Perhaps restarting crond might help.
Note that using crontab -e a file named cron.update is created in /var/spool/cron/crontabs containing the name of the user that edited its crontab. The crond daemon looks for it every minute, updates its entries and deletes the file. So use either crontab -e to edit a crontab, or if you use another editor (like pico) to edit directly /var/spool/cron/crontabs/user, after saving you must run crontab -e (you can quit without saving) just for crond.update to be created.
 
Old 02-16-2010, 01:16 PM   #9
apollyonus
LQ Newbie
 
Registered: Oct 2003
Location: Elgin
Distribution: Slackware
Posts: 5

Rep: Reputation: 0
slack env

I know this is an old thread, but here it is. Slackware's crontab -e follows wherever vi [/usr/bin/vi] points. This is usually -> elvis. You can change the symlink to point to vim (like I did), but you have to set the VISUAL or EDITOR environment variables. These are not set by the default /etc/profile unless the shell happens to be ksh (has anyone used ksh since '94?).

If you run crontab -e on your Slackware box, and you see colors, e.g. syntax highlighting, then you're most likely using vi(m) which doesn't edit the file in place. try this instead: (note: to make the change automatic, put this line in /etc/profile)
Code:
export VISUAL=`which elvis`
You can verify that the new environment variable has been set by running
Code:
env | grep VISUAL
which should return:
Code:
/usr/bin/elvis
elvis is a clone of the ex/vi text editor - feel free to check out the man page; it works just like vi.
After all this, run crontab -e again, save it, and reopen it to find that your crontab has truly been installed.

Now you can have vi point to something useful
Code:
:~# ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 12 2010-02-16 12:57 /usr/bin/vi -> /usr/bin/vim*
and run crontab -e
Code:
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
#
# test crontab entry after point vi -> vim
I found a nice writeup on cron and crontab here http://www.pantz.org/software/cron/croninfo.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab problem shafey Red Hat 4 10-31-2006 01:09 AM
Problem using crontab simenzo Linux - Newbie 4 06-07-2006 04:21 PM
crontab problem sunnyanthony Linux - Software 1 01-07-2006 05:48 AM
crontab in slackware carboncopy Slackware 2 08-02-2003 01:37 PM


All times are GMT -5. The time now is 08:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration