=== soren_ is now known as soren | ||
gansbrest | I need to run couple commands on system shutdown, how can I trigger upstart script to run on shutdown / reboot? | 21:02 |
---|---|---|
SpamapS | gansbrest: start on runlevel [06] if you want it to run in parallel with shutdown... | 21:14 |
SpamapS | gansbrest: start on starting rc RUNLEVEL=[06][newline]task to have it block shutdown until it is done | 21:15 |
gansbrest | if I run it on starting rc - will it run only on shutdown or on boot as well? | 21:16 |
SpamapS | gansbrest: RUNLEVE=[06] means "on shutdown and reboot" | 21:37 |
gansbrest | I see, so start on starting rc RUNLEVEL=[06] ( no need for AND between those? ) | 21:38 |
SpamapS | gansbrest: no, its not an AND, it is a filter | 21:38 |
SpamapS | gansbrest: RUNLEVEL != runlevel | 21:38 |
SpamapS | a bit confusing I know | 21:39 |
gansbrest | I see, thanks a lot | 21:39 |
SpamapS | gansbrest: 'starting rc' is the event, RUNLEVEL=[06] makes it only match if those environment vars match | 21:39 |
gansbrest | one more question, I need to execute multiple commands on stop, and I'm doing it like this | 22:03 |
gansbrest | task | 22:03 |
gansbrest | exec cmd1 | 22:04 |
gansbrest | exec cmd2 | 22:04 |
gansbrest | but only cmd2 gets executed? | 22:04 |
gansbrest | (basically I'm calling same command but with different options ) | 22:04 |
gansbrest | exec /usr/bin/knife node delete | 22:05 |
gansbrest | exec /usr/bin/knife node delete | 22:05 |
gansbrest | exec /usr/bin/knife client delete | 22:05 |
gansbrest | ---------------- | 22:08 |
gansbrest | created simple example which illustrates the problem | 22:09 |
gansbrest | task | 22:09 |
gansbrest | exec echo "YOOO" > /tmp/y 2>&1 | 22:09 |
gansbrest | exec echo "MUUU" > /tmp/m 2>&1 | 22:09 |
gansbrest | will execute only MUUU | 22:09 |
gansbrest | and I need both of them | 22:09 |
SpamapS | gansbrest: you want 'script\nput stuff here\nend script' | 23:02 |
gansbrest | yes, but it seems like when I use script the process keeps going | 23:02 |
gansbrest | where with task it waits for process to finish | 23:02 |
gansbrest | I ended up moving my commands to a separate script | 23:03 |
gansbrest | and execute just that one script | 23:03 |
SpamapS | gansbrest: should be identical | 23:13 |
SpamapS | gansbrest: script spawns /bin/sh and pipes the rest into it. with task, the 'start on' events will block until that /bin/sh exits | 23:13 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!