Op zondag 28 okt 2012 09:49 CET schreef hou...@houghi.org.invalid:
>>> Turn on the logging and see what happens. Perhaps the network is not yet
>>> up and running properly.
By the way what did you mean by "turn on the logging"? I did not need
it this time, but maybe next time I will.
>> That was part of the problem, but not at that moment. I used:
>> ${HOME}/bin/leafnodeFetch.sh
>
> leafnode should not be run as a user, so $HOME is not the correct place.
>
> I always imagine that I have a life and with that at least a family and
> that they are all using the same PC. If a program is not strictly for
> me, I will place it in /usr/local/bin and if it is something that needs
> to be run as root in /usr/local/sbin
That is a good tip. I will change it and for some other scripts also.
>> But when boot.local is run HOME is not defined. Is this correct or a
>> bug? It took some time to find it. It is logged on the screen, but it
>> scrolls so fast, that you do not see it. And nothing ends up im
>> /var/log/messages. :-{
>
> It might depend on how your $HOME is cofigured. Could well be that your
> $HOME is on a network. I put only things in $HOME that I need when I am
> logged in. Programs and scripts that I run with cronjob have no place in
> $HOME. /usr/local/bin is the right place for them.
With cronjob ${HOME} is defined, so that is why it caught me by
surprise. Learned something. ;-)
>> And then the gremlins hit me. The command ended in the at queue, but was
>> not executed. Kept trying, but to no avail. It turned out that I hit
>> on another bug.
>
> Seems to me that that is a feature. at might not yet be running at that
> moment.
That was not the problem, because after it was 3 again, my problem was
resolved. So it is a bug/feature, not that at was not running.
>> Summer time ended here and when that happens a job
>> that is queued for 02:03 is not executed at the first time it becomes
>> 02:03, but the second time. I think this is a bug.
>
> I do not think so. atd starts a bit later. After suspend-> resume, it is
> started as planned in /etc/pm/sleep.d/
It went equally wrong with boot and resume. And both are no problem
anymore.
> You also have a program leafnodeFetch.sh. Is there a reason you do not
> use /usr/sbin/fetchnews directly?
Yes, to make sure fetchnews is not called to often:
#!/usr/bin/env bash
set -o errexit
set -o nounset
source /SharedFunctions/functions
declare -r LOG_DIR=/root/Logging
declare -r SCRIPT_NAME=$(basename ${0} .sh)
declare -r LOG_FILE=${LOG_DIR}/${SCRIPT_NAME}_$(date '+%F').log
# End template
# Script variables
declare -r LAST_FETCH=${LOG_DIR}/${SCRIPT_NAME}_LastFetch
declare -r SECS_BETWEEN_FETCHES=900
declare -r SECS_SINCE_LAST_FETCH=$(getFileChangedSecondsAgo "${LAST_FETCH}")
# Script functions
function fetchIsToSoon {
declare -r MESSAGE="Last fetch ${SECS_SINCE_LAST_FETCH} seconds ago, need at least ${SECS_BETWEEN_FETCHES}"
echo ${MESSAGE} >>${LOG_FILE}
if isInteractive ; then
echo ${MESSAGE}
fi
}
# Main script
(echo; echo) >>${LOG_FILE}
if [[ ${SECS_SINCE_LAST_FETCH} -lt ${SECS_BETWEEN_FETCHES} ]] ; then
fetchIsToSoon
exit
fi
(
showMessageNew y Start
/usr/local/sbin/fetchnews -vv
showMessageNew y End
) &>>${LOG_FILE}
touch ${LAST_FETCH}