This image PR episode £1,838 entitled, waking up with wind-to-go, and in part of the series Bash Crypting. It is posted about wind-to-go, and in about 15 minutes long. The summary is, an over-new of a terrible, hacky method of waking up. This episode of HBR is brought to you by Analysthost.com. Get 15% discount on all shared hosting with the offer code HBR15, that's HBR15. Get your web hosting that's Honest and Fair at Analysthost.com. Today, I would like to discuss waking up, in particular, a method of waking up that I have employed. So first of all, I should probably explain that if I was any less of a morning person, I would sleep in a coffin. To instigate me, getting up every morning, I've crafted my own personal alarm clock system that is hugely complicated and highly prone to errors. So first of all, let's get into what hardware is involved in this system. So my preferred hardware platform was a DelMany9. Your should be too. It's my travel computer, a bedroom-movie player SSH terminal, alarm clock, and Chilean Frymaker with optional beverage jiller. It's just the best little computer I have ever used. The keyboard layout's a little bit funky, but as long as I am used to typing on it, it's a fantastic little machine. I can't recommend it highly enough. Batteries are $35 to replace, and it gives you seven hours of use. Just love it, love it, love it, it's a fantastic little machine. So that covers what hardware I use, but this is mostly a software operation. It's not like I don't have a DelMany9 swinging from a wire dropping on me or anything. There's some software, there's some intelligence to this. So my alarm clock, software wise, is an embarrassing combination of bash grips and audacious my favorite media player. Eventually I would like to replace the audacious portion of this whole operation with a console-based audio player for reasons that I'll discuss later on. So now down to the meat and potatoes, how it all works, how it's glued together, how when to go wakes up. So there are currently two bash grips in my crappy alarm. One of them is called Wake Up, all one word, no hyphens, no nothing, just WAK-E-U-P. And the other one is called Wake Up-Hipen-At, so the previous script, a hyphen, and a-T. So the Wake Up script is really at its heart just a wrapper that adds some air handling and some intelligence around launching the audacious media player. So it starts off by launching audacious if it can't find an instance already running. Then it proceeds to wait for five seconds for audacious to load from the disk to get itself into memory, launch itself, render its UI, all of that fun stuff. Most you likely doesn't take five seconds, but it's good to be safe if you can. So wait five seconds for everything to click into place and then it sends the play command. To audacious. It's actually toggle playback, so it's a play slash pause, but that is the best way to get it playing music in my experience. It also doesn't work very well, so it doesn't really exactly do the launching of audacious part. I have to start the audio player or else the music player never opens and I never wake up, which is a failure. You're going to hear a lot of that through this podcast. There's a lot of failures in this system, so that's a pretty big one. If I execute the wake up script and audacious is not already running, it just takes a nose dive and nobody's happy. Another failure of this script is that it does not mention which song audacious should play or which playlist for that matter. It just says, whatever you're doing audacious, start doing it. Get, you know, toggle your playback, so some things coming out of the speakers. The problem being is that if I have not set up a proper playlist in audacious or I was listening to music on a SSHFS mount that's no longer mounted, audacious has a big old playlist full of nothing spins around through its non-existent trees and throws up a big error message, which also does not wake me up, which is fantastic. So that's another glaring failure of this whole system. You'll also notice that the wake up script doesn't actually do any timing or triggering. There's no timing involved. If you want to use it as an alarm clock, you get to kind of make up your own timing around it. The way I do this is with the bash sleep command. And this isn't a failure exactly, this is more by design. So for example, if I wanted to sleep for eight hours and wake up, you literally just type in sleep space eight H ages for hours, it also accepts M for minutes, S for seconds and probably some other stuff that I don't care about. I would want to sleep for a couple of days, so there might be a days in there. So sleep space eight H would say sleep for eight hours, a semi colon to stop that command and start a new one after it's completed executing and then wake up the wake up script. I just put that after the semi colon. So you don't have to type all this out. This is all going to be in the show notes because nobody likes command line commands being read out. That's the basic function of this wake up script that I've created, not too complex. However, there is a problem with this methodology in that I have to calculate things when I want to wake up. It's very prone to errors in that aspect because I'm very prone to errors. I am not the best at math. So if I'm going to sleep at 1046 PM and 33 seconds, let's say, and I need to wake up at 7 am and 0 seconds, I need to chain sleep commands together for each unit, each individual chunk of time that can be represented for sleep. So I have to say sleep for seven hours, semi colon, sleep for 14 minutes, semi colon, just for the sake of argument, sleep for 27 seconds, semi colon, wake up. Which works fine, that's great, it does what it says, but if I get any of the math wrong, I will wake up at the wrong time, depending on where in that chain I mess up my math, I could wake up a minute early, I could wake up an hour early, or I could wake up late, either way, not ideal and a pretty large failure of this whole system. But on top of that, that I am a very groggy person sometimes when I am programming this hack together alarm clocks, script, stuff so that I am not only going to be worse at math, but I'm going to be worse at typing and entering in these commands. And since this is one giant, daisy-chained operation, if I misspell a word on the end, like if I misspell wake up, or misspell one of the sleep commands, the mini nine will wait for the first sleep command to execute and then try and execute the second command and then try and execute the third command, so if I say sleep for seven hours and then it does, it will only then try and do the next command, so if I spell cheap, cheap for 14 minutes, it's not going to understand and it's going to throw its hands up, which could be bad. It's in theory, it would only skip that 14 minute segment and it would just wake me up early. However, if I misspelled wake up, or a more important aspect of that combination, then it would just output an error to standard out and not wake me up, which is once again a failure. So, those are an awful lot of failures. To mitigate some of these problems, I wrote the second wrapper. The wake up at command is essentially a wrapper on wake up, which is a wrapper around launching audacious, so wake up dash at is a wrapper around a wrapper. That uses the at utility AT at to schedule the wake up script, so instead of manually hacking together, sleep commands every night, it accepts whatever time formats at will at. Side note, please don't make your command a very, very common word because it makes me sound like a fool when I'm trying to do a podcast. So, any format that works with the at utility can be sent to this wrapper script that I made, so for instance, you can use the command wake up at 7 AM, and that's 7 colon 0 0 space capital A capital M, just natural human language times. You could also do wake up at 6 AM on February 2nd, 2018, and that would be 6 colon 0 0 AM space 2 0 1 8 dash 0 2 dash 0 2. It's all pretty straightforward, and that's, well, that'd be a silly thing to do, but if you wanted to wake up on Groundhog's day at 2018 at 6 AM, there you go, that's your command. You can even send specific keywords into at, like, for instance, you could wake up at T-time, or midnight, or noon if you're a real slacker, and those are all recognized somehow with at. At a pretty magical utility, it accepts a lot of the random stuff that I've thrown at. It's very handy, and it has a pretty good documentation about the different formats you can send it. Mostly, I just use times because that's what I need to wake up. This wrapper also has the benefit of immediately failing. If you make a syntax error at tells you about it as soon as you hit enter, it just, it'll crash if you don't do the, the time format right, if you miss Bell wake up at, any of those will just output an error on the terminal at your, your entering it in on. So you know it happens right away, and that's, that's much more foolproof than the original wake up script. Although, because it uses the original wake up script, a lot of the previous failures are still failures. They're still carrying on with this new fancier system. Speaking of failings, audacious as a particular failing for an alarm clock, it is very, very easy to use, and because of that, it is very easy to stop or pause. That is a bad thing. If you hit the space bar, it pauses playback an audacious, and sleepy window has discovered how to use this without my help. The only defense that I have come up with for my unconscious self pausing the music and going back to sleep is to make sure A, I'm not sleepy, so that the alarm clock wakes me up at a normally naturalish time, or I have to move the network far enough away than I need to actually move myself to disable it. I'm pretty sure I do sleepwalk occasionally, but I'm pretty sure this has been mostly foolproof, where if I wake up enough to move my body somewhere, I will be awake enough not to put myself back to sleep without conscious intervention from my, my conscious brain. However, the fact that I have to do those two ridiculous steps is an enormous failure because I don't live in a very big bedroom, and there's not really any place I can put the network where it's far away enough and still close enough to an outlets that I can plug in it, so that's a big, that's a big problem. So all of this leads to a pretty logical conclusion, how do I plan to fix this horrible, terrible alarm system that I've made up for myself, and the answer is probably not gonna, the status quo is okay for right now, maybe I just have absurdly low standards, but this works just well enough to keep itself in existence, and I can live with that, I can live with mediocrity, why not? I mentioned that I was planning on removing audacious as the media player, and that's it so far, the wake up at script works pretty good, I think I'm gonna keep that, but audacious is far too convenient and user-friendly, which I imagine a lot of software projects don't get as feedback, like this is too easy to use, what's wrong with you guys? So as a replacement, I'm looking for console-based media players, it's a little bit like MPD, but I'm probably not gonna go with MPD because I don't know, I just, I don't, I feel like it's too much of a setup for a media player. I've got a couple that I've pulled down from the Debian repose, and I have not really given any of them a test, because when my alarm clock is an issue, I am ready to go to bed, which really cuts down on development time, it's very poor timing. Also, when it's failings are most glaring, I have to immediately rush around because I've all been up late, so less time for triaging bugs, more time for jumping in showers. So that's the next step. I'm going to be looking at various console-based or terminal-based media players. See what's out there? See if any are particularly good at being a media player without being particularly good at being interacted with by me while asleep. I'm hoping if I could start something in the background, I would need a terminal and some commands to bring it back up, which will be a little bit irritating for my partner, I'd imagine when I'm trying to shut off the alarm clock, and I need to remember a T-Mux command, or something along those lines, but alarm clocks aren't supposed to be friendly, they're supposed to wake you up and irritate you until you do something about it. So until I learn how to operate a terminal while completely asleep, I think that will be more successful than my current setup. And that in a nutshell is what I do every morning. That's how I wake up or I don't wake up depending on the situation. So please let me know about your over-accomplicated or simplified solution to your daily tedium that you've implemented. I would be very interested to see what other hackers are doing with, oh I don't know, maybe automating your postal mail or pest control. There's got to be some robotics pest control out there. So anyways, until then this has been window go, you can contact me in all sorts of ways. I'm on canoessocial at micro.fragdebt.com or just fragdebt.com or anything like that. You can email me at podcast at fragdebt.com and you can give me a phone call if you find my phone number. To find out how easy it really is. Heck, I probably grade you, I was found by the digital.com and the informomicon computer club and it's part of the binary revolution at binrev.com. If you have comments on today's show, please email the host directly, leave a comment on the website or record a follow up episode yourself. Unless otherwise status, today's show is released on the creative comments, attribution, share a like, free.au license.