VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: Can't edit crontab  (Read 3048 times)

mlevins

  • Member
  • *
  • Posts: 5
Can't edit crontab
« on: December 03, 2008, 10:52:07 am »

When I type in crontab -e, I can enter the commands I want to run, but nothing is ever added to the file.  Can someone explain to me how cron is working under this system?  I am logged in as root and am trying to save with a vi "wq".
Logged

bigpaws

  • Vectorian
  • ****
  • Posts: 1871
Re: Can't edit crontab
« Reply #1 on: December 03, 2008, 01:08:46 pm »

Not to be smart did you try crontab -l to see the
crontab entries?

Bigpaws
Logged

mlevins

  • Member
  • *
  • Posts: 5
Re: Can't edit crontab
« Reply #2 on: December 03, 2008, 02:40:09 pm »

Yes, this is the output:

# 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

I am trying to add the line: 30 12 * * * /usr/bin/freshclam below the daily batch jobs at 4:40am.
Logged

bigpaws

  • Vectorian
  • ****
  • Posts: 1871
Re: Can't edit crontab
« Reply #3 on: December 03, 2008, 03:11:52 pm »

try :w and then :q!

Bigpaws
Logged

overthere

  • Vectorian
  • ****
  • Posts: 1364
Re: Can't edit crontab
« Reply #4 on: December 03, 2008, 04:14:55 pm »

If cli isn't working for you, you may also open the file manager as root, click file system and goto /var/spool/cron/crontabs and right click and open in a text editor. add your line and save the file.
hope that helps
cheers
Logged
Everything Is Relative

asphyx

  • Member
  • *
  • Posts: 9
Re: Can't edit crontab
« Reply #5 on: January 12, 2009, 02:30:23 am »

If cli isn't working for you, you may also open the file manager as root, click file system and goto /var/spool/cron/crontabs and right click and open in a text editor. add your line and save the file.
hope that helps
cheers

In VL 5.9 that decided me :
Code: [Select]
vi /var/spool/cron/crontabs/root

This file is the same like the answer from crontab -e, make the changes for hours, minutes, week, month then save the file and enjoy ! :)
Logged

Pita

  • Vectorian
  • ****
  • Posts: 1338
Re: Can't edit crontab
« Reply #6 on: January 12, 2009, 03:31:15 am »

I have been wondering myself for years why vi or lately even worse 'evil' (I think that's the wrong name) anyhow something like that is used to edit crontab. I have struggled ever since with it. My solution is using the editor of 'mc' and it works as someone else suggested more or less.
Logged

kidd

  • Packager
  • Vectorian
  • ****
  • Posts: 682
Re: Can't edit crontab
« Reply #7 on: January 12, 2009, 04:44:21 am »

vi has been standard editor for years,  and lately vim has replaced vi in most systems.  Many users won't even notice many differences between vi and vim.  However, vim is much more powerful and extensible than plain vi.

Anyway, editors are one of most religious decisions in linux world, so I won't start with typical blablabla....

crontab, as many other commands like vipw or vigr use $EDITOR environment var to launch the editor.  just change it to nano, emacs or whatever console editor you prefer.

:wq