Page 1 of 1

nL cron script

Posted: Sat Oct 26, 2019 7:56 am
by joejoe
Hi,

I have a script I am trying to run from cron on Debian/Ubuntu.

Code: Select all

* * * * * joe /home/joe/winny/winny.lsp
The permissions of winny.lsp are 755.

Syslog looks like it is executing:

Code: Select all

Oct 26 01:49:01 jsfccfow CRON[6574]: (joe) CMD (joe /home/joe/winny/winny.lsp)
The winny.lsp script contains:

Code: Select all

(append-file "ltcbtc.txt" (println pairs (date (date-value) 0 "%y%m%d%H%M%S")))
The ltcbtc.txt file is already created and chmoded to 755.

I am not getting anything added to ltcbtc.txt file.

Anything I might be missing to get the nL script to run w cron?

Thank you! :-)

Re: nL cron script

Posted: Sat Oct 26, 2019 10:54 pm
by ralph.ronnquist

Code: Select all

* * * * * joe /home/joe/winny/winny.lsp
A line like the above would be fine in /etc/crontab or in /etc/cron.d/something-or-other, but for a user's crontab line (crontab -e), you'd skip the "user" field:

Code: Select all

* * * * * /home/joe/winny/winny.lsp
It's of course all nicely documented in

Code: Select all

$ man cron
hth

Re: nL cron script

Posted: Sun Oct 27, 2019 11:38 pm
by joejoe
Hi and thanks ralph,

I had tried that as well but it still doesn't append the file.

Any way to check for why it might not be working? Thanks!

Re: nL cron script

Posted: Mon Oct 28, 2019 2:42 am
by ralph.ronnquist
A script file needs to tell which interpreter to use at it's first line, so it'd be like

Code: Select all

#!/usr/local/bin/newlisp
(append-file "ltcbtc.txt" (println pairs (date (date-value) 0 "%y%m%d%H%M%S")))
if you have installed newlisp at there.

Alternatively you make an embedded executable with the script; something like

Code: Select all

$ newlisp -x winny.lsp herbie ; chmod a+x herbie
and then use that in crontab.

Code: Select all

* * * * * /home/joe/winny/herbie
.

Re: nL cron script

Posted: Mon Oct 28, 2019 3:06 am
by joejoe
ralph,

thanks for the help!

my nL script file has this already at top:

Code: Select all

#!/usr/bin/env newlisp
I can run it from the command line fine and it does it all.

I am almost ready to leave a nL process hanging just to make it done.?

Re: nL cron script

Posted: Mon Oct 28, 2019 4:49 am
by ralph.ronnquist
println ? did you mean string ?

btw, cron scripts are run in $HOME so it would append to $HOME/ltcbtc.txt

Re: nL cron script

Posted: Mon Oct 28, 2019 11:33 am
by joejoe
Working!

Moving the txt file and script to the home directory made cron all go!

You always share the best secrets ralph, thanks very much again for this!