You are not logged in.
I'm writting a hook for suspend/resume, however I've run into some trouble.
So basicly what I need is:
a) A script to stop and start mpd [done] (That's easy. Just setup mpd.conf's RUNAS user to the desired username and regardless that the mpd command is run as root it will run as the desired user)
b) A script to stop and start oss4 since it fucks up after suspend [DONE] (piece of cake...)
c) A script to view my wlan0 essid, save it to file, killall dhcpcd (the dhcpcd part, at least, is easy) and on resume to enter it again and run dhcpcd. [Need help]
(In order to start my wifi I use iwlist wlan0 scanning, I choose the desired network and then iwconfig wlan0 essid DESIREDESSID and dhcpcd wlan0, but after suspend wlan0 looses it's settings so I need to make a script to enter them back.)
I was thinking about something like iwconfig wlan0 | grep ESSID, but it returns (as expected)
[dheart@lightbringer ~]$ iwconfig wlan0 | grep ESSID
wlan0 IEEE 802.11g ESSID:"ESSID_NAME"
I'm quite new at bash scripting and I have no idea how to write something that complex.
d) Also sonata, my desired mpd frontend looses connection to mpd if mpd is restarted while it is running. So I need something to stop sonata (that's easy - killall sonata) and after that to run it (but not as root)... So, my question is how to run a program as normal user from /etc/pm/sleep.d/ hook [NEEDHELP].
Here's what I've written so far
#!/bin/bash
case $1 in
hibernate)
echo "Killing mpd and stopping oss4"
mpd --kill & /etc/rc.d/oss-linux-free stop
;;
suspend)
echo "Killing mpd and stopping oss4"
mpd --kill & /etc/rc.d/oss-linux-free stop
;;
thaw)
echo "Starting oss4 and mpd"
/etc/rc.d/oss-linux-free start & mpd
;;
resume)
echo "Starting oss4 and mpd"
/etc/rc.d/oss-linux-free start & mpd
;;
*) echo "Wrong call"
;;
My victim you are meant to be
No, you cannot hide nor flee
You know what I'm looking for
Pleasure your torture, I will endure...
Offline
you're probably better off starting network autodetection on resume, I know most people suspend to go between, for example, home and work, or home and the intarwebz cafe, and seldom suspend and resume in the same location reliably.
Offline