Tuesday, October 15, 2019

Things a smidge useful about having been around a while, and stuck in heterogeneous computing environments.

One of my routine tasks when Cream reboots for updates every now and then, is to run a simple script that runs my post bot for sending my blog posts to D*. The issue that the Intel chipset likes to hang on reboots over USB things is a different issue than making sure software starts up on sign in.

In *nix land, the cheesey, read simplist, method is just insert it into your X session script (Yes, I still use xinit :P). Fancier session managers, XDG autostart, and gasp, systemd user units, also exist. Of course there's always more than one way to do it. Not to mention that when its your box, you can abuse the system level parts ^_^.

NT on the other hand, I remember the easiest way. Go stick a shortcut to the script in the startup directory and be done with it. That's "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup" in this day and age.

My scripts are pretty simple. The first is a wrapper (post-bot.cmd) that goes to where I keep my post bot's install, and runs this daemon.cmd script:


@ECHO OFF

IF EXIST %VIRTUAL_ENV% GOTO post_loop

:load_venv
    ECHO Loading venv
    CALL .\python\Scripts\activate.bat
    GOTO post_loop

:post_loop
    ECHO Running
    python .\python\Scripts\rss2diaspora-spider -v -s data\config.txt 
    ECHO Looping
    TIMEOUT /T 900
    GOTO post_loop


Which is sufficient for making sure it runs every fifteen minutes without having to care about much more than the box rebooting. So whenever my blog's RSS feed updates, my posts eventually get converted to markdown and pushed to Diaspora without me having to care too much.

Yay, for laziness!

No comments:

Post a Comment