Problems in Automation

Written on January 2, 2017

Carrier.py has been running automatically since yesterday. This is a short time to run into problems.

The first attempt at automation was a simple manual button procedure. I push a button. Output returns to me. I’m glad and can read the latest news on lotro.dreamwidth.org without needing to manually send it. This is a vast improvement, and I was glad.

The next task was to create a cron job.

This is not my first time using cron. In the past I’ve used cron to auto update clients and run pseudo-daemons. This is one of those times I need to run a pseudo-daemon. My first attempt did not seem to work, as I ran:

$ crontab -e
$ 0 9 * * * bash /home/user/lotro/file.sh

I did some research and found a few things. I settled with this procedure that does work.

$ cd /etc/cron.d
$ sudo nano lotroUpdate
nano
[0]
[1]0 9 * * * user /home/user/lotro/file.sh
[2]

The contents of /home/user/lotro/file.sh are:

python /home/user/lotro/carrier.py
perl /home/user/jlj.pl -f

When I run file.sh within the lotro directory, the following results occur:

carrier.py executes that saves a file to .jlj/queue/
jlj.pl executes that "flushes" all messages in queue, sending it to DW for posting

When cron runs this, it runs the bash script in its own environment.

I did not realize this until I created a log that posted errors from python and perl. Both could not find the files and would not run.

I’m frustrated that I won’t be able to run my bot automatically just yet, but it’s inspiring to know that I now know early-on what I should be looking for. I need constant paths. And I need to be able to call these constant paths within the software itself. Though carrier has yet to be complete, the prototype’s failures can be overcome with new implementation of the modules I’m using.

My first thought was to look at the ConfigParser module to see if they could use some development, but there appears to already be issues that the community has experienced, as expressed here. I also wouldn’t know how to contact the devs and if they already know about the issue of constant paths. The work around in the latter link might come in use.


Take me home.

Check out the archive.