You are not logged in.

#26 2011-12-06 14:24:28

fogobogo
Member
Registered: 2008-08-24
Posts: 83

Re: [wakeup] testers wanted.

falconindy wrote:

strptime(3) is pretty much an analog to sscanf(3) and is meant for parsing well-known structured data. You'd have to reverse engineer (so to speak) the user's intentions. At that point, you may as well just be parsing the string manually.

Yeah it is pretty rigid, but I'd much prefer to inflict that little pain onto the user instead of trying to parse a string manually that might, or might not be something that could resemble some time.
The way I thought of it was to allow something like "8:00" _maybe_ even something like "5:00AM" depending on locale but that's the most what would be planned for. If someone really wants to wake his box if it is a Friday in the timezone of China and if Saturn and Mars are aligned but only on a full moon he/she better grabs a calculator or uses your workaround.

Offline

#27 2011-12-28 12:29:53

fogobogo
Member
Registered: 2008-08-24
Posts: 83

Re: [wakeup] testers wanted.

Alright, falconindy provided a range of patches to mangle the (otherwise totally fine, I might add!) code and generally helped a lot getting a better understanding of what I was actually doing there. Either way, it's all pretty now with lots of functions and little comments.

You can now execute a command right after waking up from suspend as well as substitute the suspend command for something else. A word of notice though, the command you execute will be run with root privileges (there is no clean way to fix that), wants the absolute path (not "~/") and mind to put the command in quotes if you have more than one argument.

Example:

$./wakeup 48h -e "mpg123 -@ /home/user/stream/my\ radio.pls"

I will see if I can write a manpage for it some time.

Offline

Board footer

Powered by FluxBB