Ask a Question related to Ubuntu, Design and Development.
-
SINNER #1
Re: cron & leafnode
* Richard G. Riley wrote in alt.os.linux.ubuntu:
> I'm having some issues with leafnode.> slrn is connected and if I "sudo fetchnews" manually everything is ok.> There is a leafnode file in /etc/cron.d> According to the man page this should be picked up & processed by
> cron.> However there appears to be no automatic/scheduled call to
> fetchnews. Any ideas? Logs to check?> The leafnode in cron.d is:Here is mine in my root crontab> 8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then /etc/news/leafnode/do-fetch-news; fi
root@gates-of-hell:/home/sinner # crontab -e
0,10,20,30,40,50 * * * * /usr/local/sbin/fetchnews
Fetchnews runs every 10 minutes every day.
--
David
By rule #1, 5.005 should always allow localization of lexical @_ . . .
-- Larry Wall in <199710011704.KAA21395@wall.org>
SINNER Guest
-
cron job
If the cron job run every 15 minute, it will fill up mail box. Does anyone has any idea. Thanks "Davide Bianchi" <davideyeahsure@onlyforfun.net>... -
rsh and cron
I have Ultra 60 with Solaris 2.6, and the rsh always work fine, until recently I foud the rsh does not work on the Ultra 60. But I don't have any... -
cron
Not specific to PHP really, but it all started with a simple PHP script I was automating... I've used cron/crontab on a zillion machines, and it... -
Cron Not Restarted
While we have cron listed in inittab, it occasionally dies and does not restart. I have to start it with "nohup /usr/sbin/cron &" manually as... -
Help with Leafnode filters
Hello again, Now that I have my local Leafnode News working, I tried to setup some filters. This is what my filters file looks like: ... -
SINNER #2
Re: cron & leafnode
* Richard G. Riley wrote in alt.os.linux.ubuntu:
> "SINNER"posted the following on 2006-03-05:>> * Richard G. Riley wrote in alt.os.linux.ubuntu:>>> I'm having some issues with leafnode.>>> slrn is connected and if I "sudo fetchnews" manually everything is ok.>>> There is a leafnode file in /etc/cron.d>>> According to the man page this should be picked up & processed by
>>> cron.>>> However there appears to be no automatic/scheduled call to
>>> fetchnews. Any ideas? Logs to check?>>> The leafnode in cron.d is:>>> 8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then /etc/news/leafnode/do-fetch-news; fi>> Here is mine in my root crontab
>> root@gates-of-hell:/home/sinner # crontab -e>> 0,10,20,30,40,50 * * * * /usr/local/sbin/fetchnews>> Fetchnews runs every 10 minutes every day.Yes. If I absolutely must be root to do something:> I have to "sudo crontab -u root -e" to get something similar to
> work. Doesn't fetchmail have to run as root?
sudo su -
Do what I need and log out, in this case a simple
crontab -e
--
David
Vegetarians beware! You are what you eat.
SINNER Guest
-
Centurion #3
Re: cron & leafnode
Richard G. Riley wrote:
Did you look at do-fetch-news (it's a script) to see what it does? If you> I'm having some issues with leafnode.
>
> slrn is connected and if I "sudo fetchnews" manually everything is ok.
>
> There is a leafnode file in /etc/cron.d
>
> According to the man page this should be picked up & processed by
> cron.
>
> However there appears to be no automatic/scheduled call to
> fetchnews. Any ideas? Logs to check?
>
> The leafnode in cron.d is:
>
> 8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then
> /etc/news/leafnode/do-fetch-news; fi
>
>
> I have checked do-fetch-news exists.
>
> I'm stumped.
did you would see that references a file like this:
# Get configuration
.. /etc/news/leafnode/debian-config
So looking in the /etc/news/leafnode/debian-config file you find the
following:
# DO NOT MODIFY THIS FILE BY HAND - use 'dpkg-reconfigure leafnode' to
# modify it instead. The package will overwrite this file with the
# options selected using debconf whenever the postinst script is run.
# What sort of network connection do we have? Valid values are PPP,
# permanent and none.
NETWORK=permanent
Now a picture is forming. OK, go back and look at the logic in
do-fetch-news:
if [ "$NETWORK" = "permanent" -a -x /usr/sbin/fetchnews ]; then
/usr/sbin/fetchnews
fi
AH! Bingo!! If the $NETWORK variable from debian-config is *NOT* "permanent"
then /usr/bin/fetchnews will never get executed, the do-fetch-news script
will gracefully fall through and nothing will be logged except that cron
ran the do-fetch-news script as instructed :)
So run "sudo dpkg-reconfigure leafnode" and change your network to
permanent :) If you don't have a network connection, cron will send root a
message with all the complaints from fetchnews.
Personally, I ditched the cron entry for do-fetch-news, and instead replaced
it with the following:
----- sync-news.sh -----
#!/bin/bash
# define some variables
CONFIG=/etc/news/leafnode/config
SERVER=`egrep -vi '^#|^$' $CONFIG | grep -m 1 server | \
awk -F= '{ print $NF }' | sed s/\ //g`
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/adminscripts
testnet(){
ping -c 1 $SERVER &> /dev/null
echo $?
}
if [[ `testnet` -eq 0 ]]; then
# network is up and we can reach the news server
/usr/sbin/fetchnews;
fi
----- sync-news.sh -----
Make it executable (sudo chmod 0744 sync-news.sh), make root own it (sudo
chown root:root sync-news.sh) and replace "do-fetch-news" in your crontab
with "/path/to/sync-news.sh". Voila! Now it doesn't matter what damn
connection you have, it will only do a fetchnews run if the server is
pingable :)
Beware - not all news servers can be pinged. Depends entirely on whether or
not the admins allow ICMP traffic. If your news feed doesn't respond to
pings install the "hping3" package and use the following testnet()
function:
testnet(){
hping3 $SERVER -c 1 --tcpexitcode -p 119 -S &>/dev/null
echo $?
}
Now change the if statement to this:
if [[ `testnet` -eq 18 ]]; then
The reason is that hping3 with the --tcpexitcode will return the tcpflag
from the ping: 18=SYN+ACK - ie, NNTP is up on $SERVER (20=RESET+ACK - ie,
received our packet but service is down, and 1=program error, like network
unreachable). So the ONLY response from hping3 we're interested in is TCP
status code 18 :)
Hope all this make some sense :P
Cheers,
James
--
All models over 18 years of age.
Centurion Guest
-
Toby Newman #4
Re: cron & leafnode
On 2006-03-05, SINNER <99nesorjd@gates_of_hell.invalid> wrote:
Whilst we're here skinning these cats:> * Richard G. Riley wrote in alt.os.linux.ubuntu:>>> I'm having some issues with leafnode.>>> slrn is connected and if I "sudo fetchnews" manually everything is ok.>>> There is a leafnode file in /etc/cron.d>>> According to the man page this should be picked up & processed by
>> cron.>>> However there appears to be no automatic/scheduled call to
>> fetchnews. Any ideas? Logs to check?>>> The leafnode in cron.d is:>>> 8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then /etc/news/leafnode/do-fetch-news; fi
> Here is mine in my root crontab
> root@gates-of-hell:/home/sinner # crontab -e
>
> 0,10,20,30,40,50 * * * * /usr/local/sbin/fetchnews
>
> Fetchnews runs every 10 minutes every day.
*\10 * * * * /usr/sbin/fetchnews -f >> /var/log/crontablog 2>&1
Fetchnews runs every 10 minutes, and creates an ever-growing pointless log file
too. That's added value :)
--
-Toby, who...
Add the word afiduluminag to the subject
field to circumvent my email filters.
Ignore any mail delivery error.
Toby Newman Guest
-
SINNER #5
Re: cron & leafnode
* Toby Newman wrote in alt.os.linux.ubuntu:
> On 2006-03-05, SINNER <99nesorjd@gates_of_hell.invalid> wrote:>> * Richard G. Riley wrote in alt.os.linux.ubuntu:>>> I'm having some issues with leafnode.>>> slrn is connected and if I "sudo fetchnews" manually everything is ok.>>> There is a leafnode file in /etc/cron.d>>> According to the man page this should be picked up & processed by
>>> cron.>>> However there appears to be no automatic/scheduled call to
>>> fetchnews. Any ideas? Logs to check?>>> The leafnode in cron.d is:>>> 8 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ]; then /etc/news/leafnode/do-fetch-news; fi>> Here is mine in my root crontab
>> root@gates-of-hell:/home/sinner # crontab -e>> 0,10,20,30,40,50 * * * * /usr/local/sbin/fetchnews>> Fetchnews runs every 10 minutes every day.> Whilst we're here skinning these cats:Ha! Love it. Thanks! Nothing really bought here other than keystrokes> *\10 * * * * /usr/sbin/fetchnews -f >> /var/log/crontablog 2>&1
thought right? I mean, its not an efficiency thing is it?
No thanks! It already gets logged and sends me mail!> Fetchnews runs every 10 minutes, and creates an ever-growing pointless
> log file too. That's added value :)
:)
--
David
If I had only known, I would have been a locksmith.
-- Albert Einstein
SINNER Guest



Reply With Quote

