|
Problem description: I looked up how to schedule tasks in Linux and the answer I found was to use crontab. So I followed the instructions and set up a couple of test cases. When I type crontab -l I see: 45 16 * * * vivaldi http://radio.abc.net.au/stations/triplej/live?play=true 50 16 * * * mate-calc My understanding was that my web browser (Vivaldi) should open up at 4:45pm to the Triple J listen live page, and five minutes later the calculator app should open. Those commands work fine when typed straight into the terminal. But nothing happened at 16:45 or at 16:50. As far as I can tell, absolutely nothing at all. Attempted fixes: I tried setting the times to UTC in case it wanted that instead of local time, but that also didn't do anything. Recent changes: None. -- Operating system: Linux Mint 17.3 'Rosa' MATE 64 bit Location: Australia I have Googled and read the FAQ: Yes
|
# ? Oct 8, 2017 07:13 |
|
|
# ? May 3, 2024 14:40 |
|
Tiggum posted:Problem description: I looked up how to schedule tasks in Linux and the answer I found was to use crontab. So I followed the instructions and set up a couple of test cases. When I type crontab -l I see: You seem to be trying to run GUI programs from crontab. In Linux, a GUI program uses X Window System, which has certain requirements. First, the program must have the $DISPLAY environment variable set to a valid value - your graphical login session and all its terminals will have that, but any processes started from crontab won't. Neither will any login sessions on text-based virtual consoles, or remote SSH sessions: if you are using SSH with X-forwarding, then that session will have a different $DISPLAY value. Second, there is a file in your home directory: ~/.Xauthority. It contains a "session cookie": without access to a valid cookie, the display server will reject the application. Each time the X display server is restarted or you log out, the server regenerates the cookie. At GUI login, your session gets a copy of it. Third, access to sound devices is typically restricted to whoever is currently logged on the system locally, by default. This is usually managed by PAM and other componets as a part of the login/logout process. You'll need to do something to grant your account permission to access sound devices even without an active local login session: in most modern distributions, this can usually be achieved by adding your account to the "audio" user group. This is a simple command that you'll need to do only once: code:
You might want to set up a script that prepares the necessary things and then runs the browser with the desired URL. Here are the things your script would need to do: 1.) Setting up the $DISPLAY environment variable would be easy: the value for "the default local display on this computer" is ":0.0". code:
For example, on my Debian 9 with KDE, the location of the master session cookie file is visible in the process listing: code:
Here's an one-liner for grabbing a copy of it and adding it to your ~/.Xauthority file, once the filename is known: code:
3.) Now the preparations are done and your script can start the browser. Or the calculator, if you wish.
|
# ? Oct 8, 2017 23:56 |
|
OK, looks like this is way too complicated for me, I'll have to find some other solution. Thanks anyway.
|
# ? Oct 9, 2017 01:31 |
|
Tiggum posted:OK, looks like this is way too complicated for me, I'll have to find some other solution. Thanks anyway. Alternatively, if you're a masochist, count the number of seconds until the desired time and use sleep instead of crontab. I'm sure there are GUI programs on Linux these days that can do what you want. Especially as part of desktop environments. If you give that up, you'll have to resort to the terminal or find a program with a short list of dependencies.
|
# ? Oct 29, 2017 04:52 |
|
Viscart posted:Read a basic tutorial on crontab, install mplayer/mpv, set up an alarm by arranging a certain sound file to be played at a certain time. I ended up just using my Windows computer instead. It's slightly less convenient, but it works.
|
# ? Oct 29, 2017 05:04 |