Struggling with cron (error 127)
by bassmadrigal from LinuxQuestions.org on (#4V79P)
I was trying to setup a cron job to keep my local Slackware mirrors up-to-date. I created a script to run Alien Bob's update-slackware-current.sh (and I modified a second called update-slackware-14.2.sh).
The script itself runs fine and will update my mirrors, so I tried adding it to my users crontab via crontab -e and setting it to run at 5AM every day. I feel like I have everything set up properly and even switched to use absolute locations to prevent any issues with cron's env variables (or lack thereof), but the next day I'd get an error 127 in my /var/log/cron.
So, to test this out even more, I'd add a second entry and have it run every minute... but that works fine with the exact same command, just running more frequently :scratch:
So, here's my crontab line (including the one to run every minute that actually works, but commented out):
Code:0 5 * * * * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
#*/1 * * * * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh > /dev/null 2>&1The errors:
Code:Nov 11 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh > /dev/null 2>&1
Nov 12 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
Nov 13 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
Nov 14 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
Nov 15 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1And the script itself:
Code:#!/bin/bash
cd /share/gothrough/slackware-mirrors/
/usr/bin/mv ./update.log ./update.log.old
/usr/bin/echo -e "=========Slackware64-14.2==========\n" &> ./update.log
/bin/sh /share/gothrough/slackware-mirrors/mirror-slackware-14.2.sh &>> ./update.log
/usr/bin/echo -e "\n=========Slackware64-current==========\n" &>> ./update.log
/bin/sh /share/gothrough/slackware-mirrors/mirror-slackware-current.sh &>> ./update.logAs said, if I remove the hash on the second cron line, it runs perfectly fine. I've even tried just changing that line to run at 5AM and I still get the error 127. I'm really stumped by this and have been working with it for around a month, even though I expect it's something really simple that I'm missing.
Any suggestions/hints?


The script itself runs fine and will update my mirrors, so I tried adding it to my users crontab via crontab -e and setting it to run at 5AM every day. I feel like I have everything set up properly and even switched to use absolute locations to prevent any issues with cron's env variables (or lack thereof), but the next day I'd get an error 127 in my /var/log/cron.
So, to test this out even more, I'd add a second entry and have it run every minute... but that works fine with the exact same command, just running more frequently :scratch:
So, here's my crontab line (including the one to run every minute that actually works, but commented out):
Code:0 5 * * * * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
#*/1 * * * * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh > /dev/null 2>&1The errors:
Code:Nov 11 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh > /dev/null 2>&1
Nov 12 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
Nov 13 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
Nov 14 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1
Nov 15 05:00:01 craven-moorhead crond[1934]: exit status 127 from user jbhansen * /bin/bash /share/gothrough/slackware-mirrors/update-mirrors.sh >/dev/null 2>&1And the script itself:
Code:#!/bin/bash
cd /share/gothrough/slackware-mirrors/
/usr/bin/mv ./update.log ./update.log.old
/usr/bin/echo -e "=========Slackware64-14.2==========\n" &> ./update.log
/bin/sh /share/gothrough/slackware-mirrors/mirror-slackware-14.2.sh &>> ./update.log
/usr/bin/echo -e "\n=========Slackware64-current==========\n" &>> ./update.log
/bin/sh /share/gothrough/slackware-mirrors/mirror-slackware-current.sh &>> ./update.logAs said, if I remove the hash on the second cron line, it runs perfectly fine. I've even tried just changing that line to run at 5AM and I still get the error 127. I'm really stumped by this and have been working with it for around a month, even though I expect it's something really simple that I'm missing.
Any suggestions/hints?