Disconnect/Reconnect cronjob

View: New views
4 Messages — Rating Filter:   Alert me  

Disconnect/Reconnect cronjob

by Vassilis V.-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all!

Since my ISP is disconnecting my connection every 24 hours I would like
to make sure that happens in the early morning hours rather than at noon.

After a bit of searching I found the .sh script that works but I havent
managed to get it to work properly.

This is the .sh script:

#!/bin/sh
# Reconnect and update DynDNS

/etc/rc.d/uplinks stop main
sleep 90
/usr/local/bin/setddns.pl
sleep 30
/usr/local/bin/setddns.pl

I made a folder called /customscripts and moved the .sh file in there.
Running it manually via "sh <scriptname.sh> works perfectly, getting it
to run at a specific time is where I am stuck.

I edited the /etc/crontab file and added at the end:

30 3 * * * root /customscripts/reconnect.sh

This should run the script at 03:30 in the morning but unfortunately it
doest work. Since this is my first cronjob ever I am almost certain I
have missed something trivial but important :-)

Thank you!

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user

Re: Disconnect/Reconnect cronjob

by Rafael Fonseca :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why did you add the 'root' part in front of the script? AFAIK, that shouldn't be there. Just make sure you chmod 755 the script, and you don't even need to sh <script>, as you already have the #!/bin/sh line there, which tell whatever shell you're in that they should use sh to run your script.

2009/7/30 Vassilis <Bigraccoon@...>
Hello all!

Since my ISP is disconnecting my connection every 24 hours I would like
to make sure that happens in the early morning hours rather than at noon.

After a bit of searching I found the .sh script that works but I havent
managed to get it to work properly.

This is the .sh script:

#!/bin/sh
# Reconnect and update DynDNS

/etc/rc.d/uplinks stop main
sleep 90
/usr/local/bin/setddns.pl
sleep 30
/usr/local/bin/setddns.pl

I made a folder called /customscripts and moved the .sh file in there.
Running it manually via "sh <scriptname.sh> works perfectly, getting it
to run at a specific time is where I am stuck.

I edited the /etc/crontab file and added at the end:

30 3 * * * root /customscripts/reconnect.sh

This should run the script at 03:30 in the morning but unfortunately it
doest work. Since this is my first cronjob ever I am almost certain I
have missed something trivial but important :-)

Thank you!

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user

Re: Disconnect/Reconnect cronjob

by Vassilis V.-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Rafael!

I added the root there since it was there from a howto I found on a
german forum. I removed it and the script works, thank you!

Seeing in the crontab file the daily, hourly, etc cron jobs, I noticed
the lines "[ -x /bin/run-parts ] && run-parts --report" in front of the
command. I dont understand what they mean and should I add them to my
own cronjob aswell?

Thank you for your help!
Vassilis


Rafael Fonseca schrieb:

> Why did you add the 'root' part in front of the script? AFAIK, that
> shouldn't be there. Just make sure you chmod 755 the script, and you
> don't even need to sh <script>, as you already have the #!/bin/sh line
> there, which tell whatever shell you're in that they should use sh to
> run your script.
>
> 2009/7/30 Vassilis <Bigraccoon@... <mailto:Bigraccoon@...>>
>
>     Hello all!
>
>     Since my ISP is disconnecting my connection every 24 hours I would like
>     to make sure that happens in the early morning hours rather than at
>     noon.
>
>     After a bit of searching I found the .sh script that works but I havent
>     managed to get it to work properly.
>
>     This is the .sh script:
>
>     #!/bin/sh
>     # Reconnect and update DynDNS
>
>     /etc/rc.d/uplinks stop main
>     sleep 90
>     /usr/local/bin/setddns.pl
>     sleep 30
>     /usr/local/bin/setddns.pl
>
>     I made a folder called /customscripts and moved the .sh file in there.
>     Running it manually via "sh <scriptname.sh> works perfectly, getting it
>     to run at a specific time is where I am stuck.
>
>     I edited the /etc/crontab file and added at the end:
>
>     30 3 * * * root /customscripts/reconnect.sh
>
>     This should run the script at 03:30 in the morning but unfortunately it
>     doest work. Since this is my first cronjob ever I am almost certain I
>     have missed something trivial but important :-)
>
>     Thank you!
>
>     ------------------------------------------------------------------------------
>     Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>     30-Day
>     trial. Simplify your report design, integration and deployment - and
>     focus on
>     what you do best, core application coding. Discover what's new with
>     Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>     _______________________________________________
>     Efw-user mailing list
>     Efw-user@... <mailto:Efw-user@...>
>     https://lists.sourceforge.net/lists/listinfo/efw-user
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Efw-user mailing list
> Efw-user@...
> https://lists.sourceforge.net/lists/listinfo/efw-user

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user

Re: Disconnect/Reconnect cronjob

by Rafael Fonseca :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not necessary in this case. They're for error reporting and tidying up  
output from cron-jobs, but in your case I'd just ignore them.
--
Rafael Fonseca
www.nunca.com.br

On 30/07/2009, at 11:19 PM, Vassilis wrote:

> Hello Rafael!
>
> I added the root there since it was there from a howto I found on a
> german forum. I removed it and the script works, thank you!
>
> Seeing in the crontab file the daily, hourly, etc cron jobs, I noticed
> the lines "[ -x /bin/run-parts ] && run-parts --report" in front of  
> the
> command. I dont understand what they mean and should I add them to my
> own cronjob aswell?
>
> Thank you for your help!
> Vassilis
>
>
> Rafael Fonseca schrieb:
>> Why did you add the 'root' part in front of the script? AFAIK, that
>> shouldn't be there. Just make sure you chmod 755 the script, and you
>> don't even need to sh <script>, as you already have the #!/bin/sh  
>> line
>> there, which tell whatever shell you're in that they should use sh to
>> run your script.
>>
>> 2009/7/30 Vassilis <Bigraccoon@... <mailto:Bigraccoon@...>>
>>
>>    Hello all!
>>
>>    Since my ISP is disconnecting my connection every 24 hours I  
>> would like
>>    to make sure that happens in the early morning hours rather than  
>> at
>>    noon.
>>
>>    After a bit of searching I found the .sh script that works but I  
>> havent
>>    managed to get it to work properly.
>>
>>    This is the .sh script:
>>
>>    #!/bin/sh
>>    # Reconnect and update DynDNS
>>
>>    /etc/rc.d/uplinks stop main
>>    sleep 90
>>    /usr/local/bin/setddns.pl
>>    sleep 30
>>    /usr/local/bin/setddns.pl
>>
>>    I made a folder called /customscripts and moved the .sh file in  
>> there.
>>    Running it manually via "sh <scriptname.sh> works perfectly,  
>> getting it
>>    to run at a specific time is where I am stuck.
>>
>>    I edited the /etc/crontab file and added at the end:
>>
>>    30 3 * * * root /customscripts/reconnect.sh
>>
>>    This should run the script at 03:30 in the morning but  
>> unfortunately it
>>    doest work. Since this is my first cronjob ever I am almost  
>> certain I
>>    have missed something trivial but important :-)
>>
>>    Thank you!
>>
>>    
>> ------------------------------------------------------------------------------
>>    Let Crystal Reports handle the reporting - Free Crystal Reports  
>> 2008
>>    30-Day
>>    trial. Simplify your report design, integration and deployment -  
>> and
>>    focus on
>>    what you do best, core application coding. Discover what's new  
>> with
>>    Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>    _______________________________________________
>>    Efw-user mailing list
>>    Efw-user@... <mailto:Efw-user@...
>> >
>>    https://lists.sourceforge.net/lists/listinfo/efw-user
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports  
>> 2008 30-Day
>> trial. Simplify your report design, integration and deployment -  
>> and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Efw-user mailing list
>> Efw-user@...
>> https://lists.sourceforge.net/lists/listinfo/efw-user
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Efw-user mailing list
> Efw-user@...
> https://lists.sourceforge.net/lists/listinfo/efw-user


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Efw-user mailing list
Efw-user@...
https://lists.sourceforge.net/lists/listinfo/efw-user