Score:0

solaris 10 cron job won't run but will run fine from command line

pn flag
#!/bin/sh

 

#grab oldest file from queue

stuff=\`ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1\`

#pull printer name from lp requests (first line in file)

puff=\`cat $stuff | /usr/bin/head -1 | sed -e 's/-.*//' -e 's/$/ is having issues printing from /'\`

 

if [ "$(ls -A /var/spool/lp/requests/localhost/)" ]

then

        echo $puff | /usr/ucb/mail [email protected]
else

        echo lp queue is empty | /usr/ucb/mail [email protected]

fi

Works fine as a shell script; cron cannot cat $stuff

edit2: changed these 2, same result

stuff="(ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1)"


puff="$(cat $stuff | /usr/bin/head -1 | sed -e 's/-.*//' -e 's/$/ is having issues printing from /)"
in flag
Does this answer your question? [Why is my crontab not working, and how can I troubleshoot it?](https://serverfault.com/questions/449651/why-is-my-crontab-not-working-and-how-can-i-troubleshoot-it)
Eve Bum avatar
pn flag
No that DID NOT answer the question
Andrew Henle avatar
ph flag
*Works fine as a shell script* Huh? On my Solaris system, it never gets past `stuff=\\\`ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1\\\`` - it just emits `-1: not found` with those escaped backticks in place. And Solaris `sh` does not support `( )` as a replacement for backtick evaluation, so `stuff="(ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1)"` merely sets the `stuff` envval to the literal string `(ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1)`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.