Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
So I'm pretty new to Ubuntu. What I want to do is a timed startup.
Right now, I'm using a program called Auto Power on and Shut down on Windows. It let's me set times for the computer to shutdown, power on, hibernate, sleep, and etc.
Is there any program or any script you can write for Ubuntu that lets you do this? I need something like:
Tell computer to turn off at 10am.
*run programs*
Tell computer to (does Linux have hibernate?) something that isn't shutdown but looks like it's shutdown at 5pm. I use hibernate in Windows.
No program can run while the computer is off. So, there's no possible script or program that can turn on automatically a computer that's off (or hibernated).
The only thing I can think of is, if you have another computer that's always on on the same LAN, use it to do WoL (wake on LAN). Your computer has to support it though. You will probably find this option in your BIOS, and you might need an aditional wire between your LAN and your motherboard.
About shutting it down, there's no problem. As someone said above, you can do that by scheduling a cron job on that same computer. Read about crontab and cron in general in the internet and try to do it yourself, that way you'll learn. If you have problems then ask here.
Some BIOSs have a feature where you can wake up the computer at a set time and yes there are utilities for both Windows and linux to wake up a computer from standby. I've never tried them so do not know how well it works. You can use cron to run tasks at a particular time or at startup but it will not boot up the computer.
No program can run while the computer is off. So, there's no possible script or program that can turn on automatically a computer that's off (or hibernated).
The only thing I can think of is, if you have another computer that's always on on the same LAN, use it to do WoL (wake on LAN). Your computer has to support it though. You will probably find this option in your BIOS, and you might need an aditional wire between your LAN and your motherboard.
About shutting it down, there's no problem. As someone said above, you can do that by scheduling a cron job on that same computer. Read about crontab and cron in general in the internet and try to do it yourself, that way you'll learn. If you have problems then ask here.
Well that's what my Windows program does, it wakes the computer up in hibernation.
I'll go try that set time for standby.
---------- Post added 07-05-11 at 11:39 AM ----------
Oh and one more question, is there a way to remotely control the computer using Windows?
Well that's what my Windows program does, it wakes the computer up in hibernation.
Obviously, I don't know very well how hibernation works. Still, you can't use a program to power up a computer that's powered off.
Quote:
Oh and one more question, is there a way to remotely control the computer using Windows?
That depends on what do you want to do. You can login remotely using putty from windows if you have a working ssh server on linux. There are many alternatives.
Okay so I've found this thing called rtcwake, it's supposed to wake up your computer after X number of seconds. You can set it to standby, sleep, hibernate.
For some reason it isn't working for me. When I do:
sudo rtcwake -m disk -s 60
It says it'll wake in 60 seconds but it doesn't, my computer stays off. I have to actually boot it up again and then it wakes up from the hibernation. Any help?
I believe ACPI wakeup is more portable. Just write the wakeup time (seconds since epoch) to /sys/class/rtc/rtc0/wakealarm . Use for example
Code:
sudo sh -c 'date +%s -d "when" > /proc/sys/class/rtc/rtc0/wakealarm'
where when is a human-readable date, e.g. "5pm tomorrow" or "2011-12-31 23:59:59". This assumes you have set your hardware clock to UTC, i.e. in Ubuntu you have UTC=yes in /etc/default/rcS .
ACPI wakeup is screwed by hardware clock updates (hwclock --systohc). I believe this is a hardware issue common to most motherboards. Most distributions do that at shutdown, to keep the hardware clock in sync with the actual clock you use. I believe this is the cause of your problem.
Therefore, I recommend an alternate way (compared to above).
On Ubuntu, replace the script .. end script section in file /etc/init/hwclock-save.conf with something like this:
Then, put the wakeup time, as text and not as number of seconds since epoch, in /etc/wakeup instead. You can even use "tomorrow 8am" to always start the machine the next day at 8 am. You can also delete file if you don't want an automatic wakeup to happen.
If you use a custom suspend script -- for example you have a keyboard shortcut that suspends to ram --, you can insert the above (omitting the script, exec true, and end script lines) just before your pm-suspend command. That will then not only also use the /etc/wakeup file (to make sure your computer wakes up then at least), but it will ensure the hardware clock is in sync with your system clock, so it'll wake up at the correct time.
Finally, wake-on-lan works via ACPI too, but it is a separate, independent feature. You can use both WOL and ACPI wakeup at the same time. You can control WOL with ethtool , but remember to enable the source in /proc/acpi/wakeup too. (Use sudo sh -c 'echo "device on" > /proc/acpi/wakeup to enable the device.) The lspci command will show you the devices, so it's easy to compare to the sysfs nodes listed in the /proc/acpi/wakeup file to the long device names shown by lspci.
I believe ACPI wakeup is more portable. Just write the wakeup time (seconds since epoch) to /sys/class/rtc/rtc0/wakealarm . Use for example
Code:
sudo sh -c 'date +%s -d "when" > /proc/sys/class/rtc/rtc0/wakealarm'
where when is a human-readable date, e.g. "5pm tomorrow" or "2011-12-31 23:59:59". This assumes you have set your hardware clock to UTC, i.e. in Ubuntu you have UTC=yes in /etc/default/rcS .
ACPI wakeup is screwed by hardware clock updates (hwclock --systohc). I believe this is a hardware issue common to most motherboards. Most distributions do that at shutdown, to keep the hardware clock in sync with the actual clock you use. I believe this is the cause of your problem.
Therefore, I recommend an alternate way (compared to above).
On Ubuntu, replace the script .. end script section in file /etc/init/hwclock-save.conf with something like this:
Then, put the wakeup time, as text and not as number of seconds since epoch, in /etc/wakeup instead. You can even use "tomorrow 8am" to always start the machine the next day at 8 am. You can also delete file if you don't want an automatic wakeup to happen.
If you use a custom suspend script -- for example you have a keyboard shortcut that suspends to ram --, you can insert the above (omitting the script, exec true, and end script lines) just before your pm-suspend command. That will then not only also use the /etc/wakeup file (to make sure your computer wakes up then at least), but it will ensure the hardware clock is in sync with your system clock, so it'll wake up at the correct time.
Finally, wake-on-lan works via ACPI too, but it is a separate, independent feature. You can use both WOL and ACPI wakeup at the same time. You can control WOL with ethtool , but remember to enable the source in /proc/acpi/wakeup too. (Use sudo sh -c 'echo "device on" > /proc/acpi/wakeup to enable the device.) The lspci command will show you the devices, so it's easy to compare to the sysfs nodes listed in the /proc/acpi/wakeup file to the long device names shown by lspci.
Hope this helps.
Now I feel bad because you wrote this much...
I got WoL to work just a few minutes ago XD
Now I'm trying to start some scripts when it boots up...please help me at this thread:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.