LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   "crontab" to start the system automatically. (https://www.linuxquestions.org/questions/linux-server-73/crontab-to-start-the-system-automatically-908097/)

gardenair 10-14-2011 01:03 AM

"crontab" to start the system automatically.
 
hi,
I am using Cent OS 5 for squid server. At night 8:00 pm the system turn off automatically by using schedual i.e "crontab" command .

I want that the system should Turn ON automatically at 9:00 am.

Is there any way crontab command ? or other procedure so that i may not manually on the system

thanks
gardenair

michaelk 10-14-2011 01:29 AM

AFAIK there are basically two methods to automatically turn on a computer. The BIOS if it has a wake up alarm function or with another computer using WOL.

EricTRA 10-14-2011 01:41 AM

Hello,

I'm not sure you can do that from within the system itself. If the server is turned off, there's no way it can start up by itself in my opinion. There might be an option available in your BIOS to boot the server automatically at a programmed time, but that depends on your BIOS so check there. Another option is to put your server in hibernate mode and use a script from another computer to boot it IF your NIC supports Wake on Lan (WOL).

Kind regards,

Eric

gardenair 10-14-2011 02:19 AM

Thanks for your replies. "EricTRA" as you mentioned

Code:

"Another option is to put your server in hibernate mode and use a script from another computer to boot it IF your NIC supports Wake on Lan (WOL)."
Here two things i want to clear. How to push my server in hibernate mode which i use crontab command ?

2-How can i check that my Lan card has Wake on Lan feature or not.Can we say that a Lan card which can boot over lan is called "Wake on Lan " ?

thanks ,
gardenair

EricTRA 10-14-2011 02:29 AM

Hello,

You can use the commands from the pm-utils package:
Code:

pm-hibernate
to hibernate your system. In hibernation mode the system doesn't need power since the state is saved to disk.

To check if your NIC supports WOL run ethtool:
Code:

ethtool <yournic>
The output will look similar to:
Code:

eric@ericvs-laptop ~ $ sudo ethtool eth1
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: pg
        Wake-on: g
        Current message level: 0x000000ff (255)
                              drv probe link timer ifdown ifup rx_err tx_err
        Link detected: yes

Where it shows Supports Wake-on, the letters indicate what your NIC supports, g means MagicPacket support.

Kind regards,

Eric

michaelk 10-14-2011 02:40 AM

In addition the BIOS must be set to allow WOL. There might be other settings to allow wake on LAN from standby or hibernate modes.

Booting from a LAN (PXE) is not the same thing as wake on LAN (WOL)

gardenair 10-14-2011 03:15 AM

thanks "EricTRA" for guiding. I want to clear my pactuere. I am using "crontab -e" and the script i am using is

Code:

00  20 * * * /sbin/shutdown -h now
The system shoutdown at 8:00 pm with the above command.

Again there are questions in my mind

1- After the execution of "crontab -e" coomand how the command how can the hibernation will work ?


2- Kindly guide me that what is pm-utils package from where i may download it ?


3- when i use teh command "ethtool eth0 it show me the following output

Code:

[root@my-proxy ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: umbg
        Wake-on: g
        Current message level: 0x00000007 (7)
        Link detected: yes
[root@my-proxy ~]#

Kindly check that is my eth0 support "wake on LAN " ?

thanks
gardenair

EricTRA 10-14-2011 06:57 AM

Hello,

1. If you shutdown your system completely with the command in your crontab then you are not in hibernation but a complete shutdown. Your wake on lan will work but will take significantly longer then when recovering from hibernation or suspend. If you want to use the hibernation method in order to start up faster, then you'll need the pm-utils package.
2. The pm-utils package can be installed using your package manager. In CentOS:
Code:

yum install pm-utils
3. From the ethtool output you posted:
Code:

Supports Wake-on: umbg
indicates your NIC supports Wake-on-Lan. The line:
Code:

Wake-on: g
indicates it's currently configured to use MagicPacket for triggering the 'wake up'.

Kind regards,

Eric

gardenair 10-14-2011 12:42 PM

I am so much thankful "EricTRA" for your help.Now the question is how to hibernate my system.After installing "yum install pm-utils " it will available ?

2- Using "crontab -e"how can I add my system into hibernate mode ? I mean what will be the complete command that the system should hibernate at 8:00 pm ?

thanks
gardenair

EricTRA 10-15-2011 02:54 AM

Hello,

Yes, after installing pm-utils you'll have the command pm-hibernate available to put your system in hibernation instead of completely turning off. That will result in faster booting when needed.

Instead of using your shutdown command in crontab, put the hibernate command in there to replace shutdown. Have a look at the man page once you installed the pm-utils package.

Kind regards,

Eric


All times are GMT -5. The time now is 05:49 PM.