PDA

View Full Version : Linux sleeptimer


otey
November 6th, 2005, 10:36 PM
Is it possible to make a linux sleeptimer..

Or has somebody already made one?

wmcbrine
November 6th, 2005, 11:49 PM
Could you elaborate on what you mean?

There are a number of Linux commands related to sleep and timing: "sleep", "at", "time", etc.

otey
November 7th, 2005, 08:32 AM
A program to shutdown the computer at configureable times.

fx. set to shut down computer 01.00

Susana
November 7th, 2005, 04:14 PM
A program to shutdown the computer at configureable times.

fx. set to shut down computer 01.00

why don't you use cron?
http://www.clickmojo.com/code/cron-tutorial.html

otey
November 8th, 2005, 10:35 PM
I've tried to run cron. can't seem to get it working though.

What should i do to get it working?

When i type cron, it prints:

cron: can't open or create /var/run/crond.pid: Permission denied


When i type sudo cron, it prints:

cron: can't lock /var/run/crond.pid, otherpid may be 7608: Resource temporarily unavailable


As far as I know some options (like fx: 30 3 * * * user poweroff) should be written in a crontab, but when i type crontab -e and then tries to save the file. i do not have permission. Besides.. the editor thinks the file belongs in my temp folder, though it is surposed to be stored in /var/spool/cron/ something.

So i gues my question is... What do i do now?

sjpwong
November 9th, 2005, 11:47 PM
When i type cron, it prints:

cron: can't open or create /var/run/crond.pid: Permission denied


When i type sudo cron, it prints:

cron: can't lock /var/run/crond.pid, otherpid may be 7608: Resource temporarily unavailable


You do not want to run cron directly it is a daemon (service) that runs in the background.

You need to edit the cron table using "crontab -e" or for a system wide cron job "sudo crontab -e".

As far as I know some options (like fx: 30 3 * * * user poweroff) should be written in a crontab, but when i type crontab -e and then tries to save the file. i do not have permission. Besides.. the editor thinks the file belongs in my temp folder, though it is surposed to be stored in /var/spool/cron/ something.

So i gues my question is... What do i do now?

There is no user to go in there, the *whole* table is for a specific user.

And yes, you want to save it to the tmp location as crontab parses the file *after* you finish editing it.

It will tell you if you have any errors.

Beware of problems with your PATH so I recommend using the full path/name for an app eg /usr/sbin/shutdown.

Hope that helps :-)

LordHunter317
November 10th, 2005, 02:12 AM
For system wide cron, you don't run a command at all, you just edit /etc/crontab as root.

sjpwong
November 10th, 2005, 02:28 AM
For system wide cron, you don't run a command at all, you just edit /etc/crontab as root.

Oops! I really meant if you want it to run as root use sudo.