Difference between revisions of "PPP Auto Check Crontab"

From MS Computech
Jump to: navigation, search
(Created page with ''''July 09 2009''' '''PPP Auto check use crontab''' <pre> mkdir /app nano /app/check_connection.sh </pre> <source lang=bash> #!/bin/bash PATH=$PATH:/sbin # Make sure ppp0 is sti…')
 
 
Line 2: Line 2:
 
'''PPP Auto check use crontab'''
 
'''PPP Auto check use crontab'''
 
<pre>
 
<pre>
mkdir /app
+
mail:~# mkdir /app
nano /app/check_connection.sh
+
mail:~# nano /app/check_connection.sh
 
</pre>
 
</pre>
 
<source lang=bash>
 
<source lang=bash>
Line 20: Line 20:
 
Add cron
 
Add cron
 
<pre>
 
<pre>
crontab -e
+
mail:~# crontab -e
 
</pre>
 
</pre>
 
<source lang=text>
 
<source lang=text>
Line 27: Line 27:
 
Restart cron
 
Restart cron
 
<pre>
 
<pre>
/etc/init.d/cron restart
+
mail:~# /etc/init.d/cron restart
crontab -l
+
mail:~# crontab -l
 
</pre>
 
</pre>

Latest revision as of 15:42, 9 July 2009

July 09 2009 PPP Auto check use crontab

mail:~# mkdir /app
mail:~# nano /app/check_connection.sh

<source lang=bash>

  1. !/bin/bash

PATH=$PATH:/sbin

  1. Make sure ppp0 is still up

if [ "`ifconfig | grep ppp0`" == ] then ifdown ppp0

  1. ifup ppp0

poff pon dsl-provider fi </source> Add cron

mail:~# crontab -e

<source lang=text>

  • /1 * * * * sh /app/check_connection.sh

</source> Restart cron

mail:~# /etc/init.d/cron restart
mail:~# crontab -l