Troubleshooting ethernet network
|
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 12, 2015, 01:02 PM
(This post was last modified: Aug 13, 2015, 12:09 AM by Desgyz.)
The line:
0 * * * * /path/to/bashscript.sh
That line is correct the only thing you change is what's in front of the * (the path) which should work.
An example is:
0 * * * * /home/openmonitor.sh
Mike is trying to give you an example on a different interval for crontabbing.
This line (what Mike was saying) sets the interval to every 5 minutes to check if the vpn is down:
*/5 * * * * /home/openmonitor.sh
Regards,
Desgyz
Sent from my iPhone using Tapatalk
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 13, 2015, 03:26 AM
I went through all my config files when I installed the openvpn and found a "stupid" typo in my /etc/rc.local file.
ORIGINAL_IP=192.168.0.3
ORIGINAL_GW=192.169.0.1 <----- should be192.168.0.1
ip rule add from $ORIGINAL_IP lookup ovpn
ip route add default via $ORIGINAL_GW table ovpn
after I changed this I have been seeing improvements in my nzbget logg files, and the connection to the usenet-server. :p
So I have to wait and see if this makes any changes to my network issue.
But I will still try to make the crontab script to restart the vpn if it drops. How do I test the script if it works? Do I stop the openvpn service and then run the script to see if it starts the service again or what?
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 13, 2015, 04:47 AM
(Aug 13, 2015, 03:26 AM)manne Wrote: I went through all my config files when I installed the openvpn and found a "stupid" typo in my /etc/rc.local file.
ORIGINAL_IP=192.168.0.3
ORIGINAL_GW=192.169.0.1 <----- should be192.168.0.1
ip rule add from $ORIGINAL_IP lookup ovpn
ip route add default via $ORIGINAL_GW table ovpn
after I changed this I have been seeing improvements in my nzbget logg files, and the connection to the usenet-server. :p
So I have to wait and see if this makes any changes to my network issue.
But I will still try to make the crontab script to restart the vpn if it drops. How do I test the script if it works? Do I stop the openvpn service and then run the script to see if it starts the service again or what?
Hello,
That's Great to hear. I didn't even think of double checking the files.
Regards,
Desgyz
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Not Solved]
Aug 13, 2015, 07:03 AM
(Aug 12, 2015, 12:10 PM)manne Wrote: So I don't change the 0****, I have it as it is?
Do I add the 0 */5 in the if statement instead of 1?
Skickat från min SM-G925F via Tapatalk
Leave the bash script as is, I meant for the crontab it should look like this for every 5 minutes
Code:
*/5 * * * * /path/to/script
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 13, 2015, 08:37 AM
(Aug 13, 2015, 07:03 AM)Mike Wrote: (Aug 12, 2015, 12:10 PM)manne Wrote: So I don't change the 0****, I have it as it is?
Do I add the 0 */5 in the if statement instead of 1?
Skickat från min SM-G925F via Tapatalk
Leave the bash script as is, I meant for the crontab it should look like this for every 5 minutes
Code:
*/5 * * * * /path/to/script
I guess */30 would be every 30 min? And only a 0 every hour?
Skickat från min SM-G925F via Tapatalk
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Not Solved]
Aug 13, 2015, 08:38 AM
(This post was last modified: Aug 15, 2015, 09:07 AM by Mike.)
(Aug 12, 2015, 12:10 PM)manne Wrote: I guess */30 would be every 30 min? And only a 0 every hour?
Skickat från min SM-G925F via Tapatalk
Yes, exactly
Sent from my GT-I9305 using Tapatalk
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Not Solved]
Aug 13, 2015, 08:43 AM
There is a way to make scripts and crontab log to a file but I'm on my phone and can't remember the exact syntax
Sent from my GT-I9305 using Tapatalk
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 13, 2015, 11:53 AM
(This post was last modified: Aug 13, 2015, 11:55 AM by Desgyz.)
Crontab logs its actions to Syslog I believe so this command in terminal should work:
Code:
sudo grep CRON /var/log/syslog
Regards,
Desgyz
Sent from my iPhone using Tapatalk
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 13, 2015, 06:49 PM
(This post was last modified: Aug 13, 2015, 07:41 PM by manne.)
How do I fix this? Or can I discard it?
- No MTA installed, discarding output
- (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
(Does this need to be in the log, the log file will increase in file size if this continuous every hour every day )
Aug 13 19:00:01 raspberrypi /USR/SBIN/CRON[12452]: (root) CMD (/etc/openvpn/checkopenvpn.sh)
Aug 13 19:00:01 raspberrypi /USR/SBIN/CRON[12451]: (CRON) info (No MTA installed, discarding output)
Aug 13 19:17:01 raspberrypi /USR/SBIN/CRON[12551]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
I found this:
http://popularubuntuquestions.com/cron-i...he-syslog/
sudo apt-get install postfix
Do I only have to install postfix? Do you have better solution?
This is in my script file:
#!/bin/bash
ps -ef | grep -v grep | grep openvpn
if [ $? -eq 1 ] ; then
/usr/sbin/openvpn --config username.ovpn --daemon --script-security 3 system
fi
Update:
Well, I installed the postfix and managed to install it right before 20:00
When I checked the log now I only got:
Aug 13 20:00:02 raspberrypi /USR/SBIN/CRON[14022]: (root) CMD (/etc/openvpn/checkopenvpn.sh)
Aug 13 20:17:01 raspberrypi /USR/SBIN/CRON[14178]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Does this mean that the script runs good? (well, at least that it runs. I haven't had a drop in my openvpn)
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 13, 2015, 09:09 PM
It looks like it's working, I guess the best test is if there was a cut out.
Regards,
Desgyz
Sent from my iPhone using Tapatalk
|
|
Recent Posts
|
About Swap
jonescelinaa Apr 10, 2024, 06:58 AM
|
Tracker Status: Error Connection Time Out
jonesPhedra Apr 04, 2024, 08:17 AM
|
Split Tunnel Docker Containers
jonesPhedra Mar 27, 2024, 03:10 AM
|
Plex server not powerful enough, but only with s...
jonesPhedra Mar 27, 2024, 03:02 AM
|
game Geometry Dash Scratch
jonescelinaa Jan 31, 2024, 04:21 AM
|
Latest unread posts | Unanswered posts |
|