solaris 10 cron 作业无法运行,但可以通过命令行正常运行

solaris 10 cron 作业无法运行,但可以通过命令行正常运行
#!/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

作为 shell 脚本运行良好;cron 无法 cat $stuff

编辑2:更改了这两个,结果相同

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 /)"

相关内容