Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Dear Friends,
I am new to scripting. I want a help on script to schedule the shutdown and start up . I am using SUSE Linux system. Can some one guide me please every night shutdown at 7pm & start it at 7am the next day during the weekdays. On the weekends, the server only needs to restart at 7am on Mondays.
We will be very happy to help you with a script. So, post what you have written/done so far, and tell us where you're stuck. Also, please read the "Question Guidelines" link in my posting signature. Providing details is something that helps others answer your question..."SUSE Linux" doesn't tell us much.
There are many easily-found examples about how to schedule cron jobs, such as the one michaelk pointed you to. Since you've been using Linux now for two years, you must have some basic knowledge by this point. If you're needing help getting started writing a script, check out the bash scripting tutorial in my posting signature, as well as any of the THOUSANDS you can find with a brief search.
post back with your script and specific questions, and we'll be happy to help.
No, the script in the link sets the wake time as well as shutdown so only one cron job is necessary. Have you tried running the wake up test to see if it works on your computer?
Sorry I did not get the point, meaning no need of two lines is it, or through command I cannot boot the server remotely.
Please help to know where I am going wrong and what I should be doing as I need to shutdown this night
Thanks
michaelk and JJJCR are right, do you have WOL (Wake on LAN) or DRAC or iLO configured on this server? There is no script which can power on the server because once it is down why would server care about the script?
If you don't have WOL or DRAC or iLO configured do not power off the server as you will not be able to power it back on. Only go with server shutdown once you have made sure that you are able to remotely power on the server.
If you power down a system completely then would have to physically press the power button to start the system. So wake on lan and may be wake on rtc solves this problem by starting the system on a LAN(network) event. So try that first and then scripts to invoke reboot or shutdown.
Thank you. Here is the proceedings which I have done after the suggestions advised by you all
I have completed the WOL set up in the yast for the server which I need to shutdown and boot up on a scheduled basis
Start YaST as root user and select Network Services+WOL. If there is a DHCP server running on your computer, the WOL module displays the existing computers on your network that you can include in your WOL list.
If a DHCP server is not running, enter the remote computers manually. Click Add and enter the host name and MAC (media access connector) address for the network card. The MAC address is unique for every network device and can be displayed with:
# ip link show eth0
2: eth0: <BROADCAST,MULTICAST,NOTRAILERS,UP>
mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:80:c8:94:c3:e7 brd ff:ff:ff:ff:ff:ff
In Enter the MAC Address of the client:, enter the value contained in link/ether. Confirm with Save. The configuration with YaST is now complete.
But now I don't know what next I can do to trigger this
If you do not have any other way to power ON the computer remotely that is using iLO or DRAC then I would suggest to perform this WOL test only when someone is at DC. Incase WOL doesn't work then the person will be able to turn on the system so that you can configure it and test again.
Yes I have completed that step. So now I need to schedule it meaning I shutdown down at 7pm Today Tomorrow I need to use that WAKE UP Automatically.
How should I proceed now in terms of scripting.
Thank you
Regards
Pearl
As it says in the document:
"17.7.3. Waking up Computers
If your computers are appropriately configured, wake them up in the WOL YaST module by clicking Wake up. The selected computer then starts.
Another option is to enter the command ether-wake from the netdiag package. With this command, a particular computer can be woken up by entering its MAC address as in ether-wake 00:80:C8:94:C3:E7. Obtain help for this command with --help or -u. "
Before jumping on with script you first need to test if computer is indeed waking up. As of now you did the configuration but you are not sure if it will wake up the system. As I mentioned in my previous post make sure that you have someone at DC to power on the system incase it doesn't wake up. Did you already check BIOS and made sure that Boot from LAN is enabled?
For the scripting part you can put this command: ether-wake 00:80:C8:94:C3:E7 (mac address will be of the machine you want to wake up) in a file say wake.sh and put it in cron to run at the time you want system to wake up. Again I will emphasize that make sure you have someone at the site to power on the system incase it doesn't come up via WOL.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.