blob: 2bfc61b064ffb6eaf3130aca4dfdcc931c7b6a3b (
plain)
1 Linux:Scheduling Jobs
2 =====================
3 :author: Aaron Ball
4 :email: nullspoon@iohq.net
5
6
7 == {doctitile}
8
9 I was recently needing to schedule the reboot of a print server (Ubuntu), but
10 was unsure how. After looking around a bit, I can do all kinds of things with
11 it. For a simple use case though, here is how to reboot a server with at...
12
13 Since we're restarting the server, we need root privileges for that, so
14 we have to run this as sudo this time around. type:
15
16 ----
17 sudo at 23:00
18 ----
19
20 You should see...
21
22 ----
23 warning: commands will be executed using /bin/sh
24 at>
25 ----
26
27 Type the command you want to occur at 23:00 (11:00 pm). In our case, we're
28 going to restart the server.
29
30 ----
31 shutdown -r now
32 ----
33
34 Press **enter**. From here you press *ctrl+d* and that will save the job for
35 later execution.
36
37 The cool thing about at is how intuitive it is. For instance, we just used
38 23:00 to schedule an e-mail for 11:00 pm. Instead, we could have typed **at
39 11:00 pm**. Furthermore, if we wanted to schedule something for tomorrow at
40 11:00 pm, we could type **at 11:00 pm tomorrow**. It's a pity for those of us
41 who are forgetful...the "at" utility unfortunately does not understand
42 yesterday.
43
44 That's how to do it.
45
46 If you want to list all of the jobs for your user, use the command
47 **atq**. If you need to remove a job, use the *atrm* command (this uses
48 job numbers from the list atq produces).
49
50 Happy scheduling.
51
52 ... Really, be happy. At least you don't have to be there at 3:00 am to reboot
53 the server.
54
55 ----
56 sudo at 3:00 am a> shutdown -r now
57 ----
58
59 * ctrl+d*
60
61 ...later at 11:30 pm
62
63 ----
64 echo 'ZZZZzzzzzzzzzz...'
65 ----
66
67
68 Category:Linux
69
70 Category:Cron
71
72
73 // vim: set syntax=asciidoc:
|