FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 11-25-2010, 10:35 AM
Oliver Marshall
 
Default crontab and reboot

Hi chaps


*


If I want to schedule a reboot every four hours, do i need
to enter the command as;


*


01 /4 * * * root shutdown now -r


*


or


*


01 /4 * * * shutdown now -r


*


(note the lack of root).


*


I'm using the latter but it's not working.


*


Olly





*







--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 10:50 AM
Tony Pursell
 
Default crontab and reboot

On Thu, 2010-11-25 at 11:35 +0000, Oliver Marshall wrote:
> Hi chaps
>
>
>
> If I want to schedule a reboot every four hours, do i need to enter
> the command as;
>
>
>
> 01 /4 * * * root shutdown now -r
>
>
>
> or
>
>
>
> 01 /4 * * * shutdown now -r
>
>
>
> (note the lack of root).
>
>
>
> I'm using the latter but it's not working.
>
>
>
> Olly
>
>
>
>

It may be because it should be

shutdown -r now

(man page specifies OPTIONS before TIME).

It must, of course, be run as root.

Tony

PS I know nothing about cron jobs.




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 10:56 AM
Oliver Marshall
 
Default crontab and reboot

"PS I know nothing about cron jobs."

ahhahahah

Thanks



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 11:17 AM
Tony Pursell
 
Default crontab and reboot

On Thu, 2010-11-25 at 11:56 +0000, Oliver Marshall wrote:
> "PS I know nothing about cron jobs."
>
> ahhahahah
>
> Thanks
>
>
>

Had a look at man for crontab(1) and crontab(5). Looks like you need

0 */4 * * * root shutdown -r now

Suggest you have a look at these man files and see if you agree with me!

Tony




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 12:01 PM
David Fletcher
 
Default crontab and reboot

On Thu, 2010-11-25 at 11:35 +0000, Oliver Marshall wrote:
> Hi chaps
>
>
>
> If I want to schedule a reboot every four hours, do i need to enter
> the command as;
>
>
>
Please satisfy my curiosity - why do you want to do this? I thought the
whole point of running a reliable OS is that you don't need to reboot
it.

Dave




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 12:23 PM
Rashkae
 
Default crontab and reboot

On 10-11-25 06:35 AM, Oliver Marshall wrote:






Hi chaps

*

If I want to schedule a reboot every four hours,
do i need
to enter the command as;

*

01 /4 * * * root shutdown now -r

*

or

*

01 /4 * * * shutdown now -r

*

(note the lack of root).

*

I'm using the latter but it's not working.

*

Olly



*





Depends on which crontab you are using.



There is a system wide crontab in /etc/crontab (as well as files in the
/etc/cron.d directory).* They require you to specify the user to run as
(ie,, with the root.)



However, each user is also allowed to have his/her own crontab file
(kept in the /var/spool/cron/crontabs directory).* These are the cron
files that get intalled with the crontab command, and you do not
specify a username in the file for them)








--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 01:36 PM
Oliver Marshall
 
Default crontab and reboot

Its because we have an old NAS box running linux that seems to crash every 8 hours. So we are planning on rebooting it every 4 hours which appears, oddly, to completely resolve the issue. It's being phased out so it only has to hold on for a few more weeks.

Is there another way to schedule commands? This NAS box overwrites the crontab entries on each reboot, so scheduling a reboot works only once, then the new crontab entries get removed.

Any other ways anyone can think of?

Olly
--
Network Support
Online Backups
Server Management

Tel: 0845 307 3443
Email: oliver.marshall@g2support.com
Web: http://www.g2support.com
Twitter: g2support
Newsletter: http://www.g2support.com/newsletter
Mail: 2 Roundhill Road, Brighton, Sussex, BN2 3RF

Have you said something nice about us to a friend or colleague ? Let us say thanks. Find out more at www.g2support.com/referral

G2 Support LLP is registered at Mill House, 103 Holmes Avenue, HOVE
BN3 7LE. Our registered company number is OC316341.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 02:05 PM
Karl Auer
 
Default crontab and reboot

On Thu, 2010-11-25 at 14:36 +0000, Oliver Marshall wrote:
> Is there another way to schedule commands? This NAS box overwrites the
> crontab entries on each reboot, so scheduling a reboot works only
> once, then the new crontab entries get removed.
>
Run startup script that uses at to schedule a reboot. Call this script
reboot_later and put it in your startup sequence:

#!/bin/sh
/root/reboot_in_four_hours &

Call this script reboot_in_four_hours and put it in /root

#!/bin/sh
sleep 14400
reboot

Alternatively, call this script reboot_later and put it in your startup
sequence:

#!/bin/sh
echo reboot | at now + 4 hours

Note: All the above is totally untested!

Regards, K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/kauer/ +61-428-957160 (mob)

GPG fingerprint: B386 7819 B227 2961 8301 C5A9 2EBC 754B CD97 0156
Old fingerprint: 07F3 1DF9 9D45 8BCD 7DD5 00CE 4A44 6A03 F43A 7DEF


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 11-25-2010, 05:57 PM
Tim Henderson
 
Default crontab and reboot

> Had a look at man for crontab(1) and crontab(5). Looks like you need
>
> 0 */4 * * * root shutdown -r now
>
> Suggest you have a look at these man files and see if you agree with me!
>

This is the correct format. However, I would suggest always using the
full path to binaries and scripts when calling from crons (or scripts).
For instance:

1 */4 * * * /sbin/shutdown -r now

or

1 */4 * * * /sbin/reboot

Tim H.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 09:49 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org