LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ubuntu Automatic shutdown 10.04 (https://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-automatic-shutdown-10-04-a-842362/)

zensunni 11-04-2010 12:52 PM

Ubuntu Automatic shutdown 10.04
 
For some reason I couldn't get this to work:
http://www.liberiangeek.net/2010/06/...04-lucid-lynx/

I followed the instructions to the letter. Not sure what I'm doing wrong...

I've tried:
-rebooting before scheduled task time
-scheduling simple tasks (gedit), which does not work
-"shutdown -h now" (found that "/sbin/shutdown" didn't even work on terminal)
-scheduling a "One-time task" (I've confirmed this works, but I need a recurring task)

I've confirmed that the "shutdown -h now" task works when I click the "run selected task" button.

But every time the clock rolls on top of the scheduled task time, it just sits there and does nothing. This is infuriating.

Does there have to be a certain amount of time between when you set a task and when it will run?

I'm using ubuntu 10.04 as article says.

[Edit] I've figured it out. I used "/sbin/shutdown -h now".

So, my question now is: why did "/sbin/shutdown -h now" work, when "shutdown -h now" didn't?
They both work in the terminal. Why won't "shutdown -h now" work when the app is running it?

SonnySee 11-04-2010 01:56 PM

While it may not provide the answer to what is going wrong with your cron job, if all you are trying to do is schedule an automatic shutdown, try the program gshutdown.
You can find it in the software center, or if you prefer you can enter this in the command line:
sudo apt-get install gshutdown

According to the software's website :"GShutdown is an advanced shutdown utility which allows you to schedule the shutdown or the restart of your computer, or logout your actual session."

If you are really set on discovering what the problem is with your current setup, perhaps this link will help: https://help.ubuntu.com/community/CronHowto

There is a section that gives instructions on troubleshooting problems with cron jobs.

Hope this helps.

Cheers

repo 11-04-2010 02:00 PM

Quote:

So, my question now is: why did "/sbin/shutdown -h now" work, when "shutdown -h now" didn't?
They both work in the terminal. Why won't "shutdown -h now" work when the app is running it?
Because CRON has a limited PATH
It's always a good idea to use the full PATH to commands and files when you use CRON

Kind regards

zensunni 11-04-2010 08:14 PM

Thanks repo, sonnysee.

I was able to get it working.

Now that I have my shutdown, I just need to get xmessage working with cron to give me a warning message.


All times are GMT -5. The time now is 06:48 PM.