jump to navigation

Timed shutdown in openSUSE: kshutdown April 12, 2007

Posted by Nigel Ajay Kumar (NAyK) in First Impressions, How-To, Linux, OpenSUSE, Reviews, Screenshots, Software, Working with Linux.
trackback

I never thought I’d need it, but today I did. I needed a timer (for shutdown) in linux.For some strange reason, I DON’T have a timed shut down automatically installed in the “Shutdown” option in openSUSE, and what I needed was a feature that would allow me to shutdown after a few hours. In my openSUSE I don’t even have the option to restart in an alternative operating system. The screenshot of my shutdown screen is found below.

my official shutdown screenshot

I was doing some bittorrent downloads during an ISP limited timeframe. I had to finish by 8:00am otherwise it would cost me dearly!

Fact is, because I didn’t know how to do it (I never even did it in Windows or Ubuntu or whatever), I had to figure out from scratch.

I googled for “timed shutdown” and found two main solutions… THAT DIDN’T WORK in openSUSE.

The first solution is for Ubuntu and it is found here. Which offered the “at” command to shutdown programs after a certain time. It looked like this:

echo "killall mplayer" | at 4am

I thought it looked interesting because ultimately I simply needed ktorrent shut-down. So I replaced “mplayer” with “ktorrent” but somehow this whole phrase was not recognised by openSUSE. The error message was as follows:

warning: commands will be executed using /bin/sh
job 3 at 2007-04-13 04:00
Can't open /var/run/atd.pid to signal atd. No atd running?

I had no idea what that meant, or whether it would actually shut down “job 3”. I tried again.

The second solution is found here. Which asked me to type a command:

shutdown 4:23

This command gave me an error, saying “bash: shutdown: command not found”

So what worked? I decided to go the software route and found a small software called Kshutdown in YAST. I clicked on the non-Beta one and installed.

The programme asks what I wanted to do (shutdown, restart etc.) and by what time/date. I entered my figure and viola! Fingers crossed… it looks like it is working.

The screenshot looks like this, below.

kshutdown screenshot

Comments»

1. AnonyMouse - April 12, 2007

What about using the “shutdown” command that is present in EVERY linux distribution? You can tell it to shut down (or reboot) at a certain time. Read the manpage for more details.

2. NAyK - April 12, 2007

When I type “shutdown” in command line I get an error message that reads: “Could not run the specified command.”

3. speedygeo - April 12, 2007

I have the same problem, but solved.
I solved it by KAlarm who run this command at 7:58:

kppp -kq

I think must exist a console variant too.

4. NAyK - April 12, 2007

to speedygeo: Hey thanks, I’ll try that too.

5. munkii - April 12, 2007

nayk, you need to have a root privilege first, type:

su
man shutdown

read the manual, then try to preform a command, a typical command to shutdown your pc in 30 mins for example, would go something like this:

shutdown -h 30 byebye

for reboot you put -r argument instead of -h, “byebye” is just a comment so user’s would get a warning (if you are connecting to the machine remotely or something)

good luck

6. iheartyerface - October 23, 2007

this is why i was never a fan of SuSE, no matter what branch. it deviates from standards too much.

first off, that first error means the “at” service isn’t running. first check to make sure it’s installed (it seems to be). then, make sure you check your startup services to make sure the “at” daemon (which is what atd is) is loaded. pretty sure you can do this from YAST or whatever it is that SuSE uses to configure the system (“Control Panel”…?).

and munkii is right. 2 things:
1. shutdown must be run as root, not user.
2. the proper context is this: shutdown time 04:53
(assuming you wanted to shutdown at 4:53 am). you would have found this out if you read the MAN:
“SYNOPSIS
/sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]

time When to shutdown.

warning-message
Message to send to all users.

The time argument can have different formats. First, it can be an
absolute time in the format hh:mm, in which hh is the hour (1 or 2 dig-
its) and mm is the minute of the hour (in two digits). Second, it can
be in the format +m, in which m is the number of minutes to wait. The
word now is an alias for +0.”

also take note- as it is in the “sbin” executable directory, that means you need to be root to execute it (sbin is a directory for “system binaries”, like fdisk. things you do NOT want to give a user access to).

any other questions, feel free to visit my blog. :) i have contact info up in my “about me” page and i’d be glad to help you out.

7. BrutuZ - January 20, 2008

I’m using openSuse 10.3 right now and the shutdown command will work, but you must run it as super user (“su -” in the console window) otherwise it will not find the binary. As for the “at” thing, first you must start the service typing “service atd start” (without quotes, as usual :) in the console window.
Hope it helps at least further readers, see ya =)

8. ajith - May 6, 2008

for kde there is kshutdown.. and for gnome there is… yea u guessed it.. gshutdown.. chk em out at ubuntu repositories.. and im guessing they are also available for all distros..

9. midnightcodr - November 6, 2008

To make atd run when the machine boots, you’ll have to add it to run levels, the way I do is:
chkconfig atd on #the atd service will not start until you reboot or issue the command as follow:
/etc/init.d/atd start

10. Trilby - January 14, 2009

You can run the at daemon as root by simply typing atd at the shell prompt while logged in or su as root.
Running atd manually is the simplest response to the error message:
Can’t open /var/run/atd.pid to signal atd. No atd running?
It doesn’t matter if you run atd before or after at, as long as atd is running at the time the at job is supposed to execute.
You don’t need to run atd at startup. If you only use at occasionally, you can run atd manually if and when you need it.


Leave a comment