Skip to content

Instantly share code, notes, and snippets.

@wolfg1969
Created October 4, 2012 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfg1969/3832222 to your computer and use it in GitHub Desktop.
Save wolfg1969/3832222 to your computer and use it in GitHub Desktop.
scripts under my gentoo home directory
#!/bin/sh
sudo wvdial
#!/usr/bin/perl
# Author: Evan Hart
# Date: 07-09-09
# Version: 1.1
my $hostFile = "/etc/hosts";
my $currFile = "/etc/hosts.live";
my $diffStatus = `diff -q $hostFile $currFile`;
if( $diffStatus =~ /differ/i || !(-e $currFile) ) { # if the files differ or $currFile doesn't exist
print STDERR "DNSMASQ-ReSScript: New configuration, updating '$currFile'\n";
system "cp $hostFile $currFile";
}else{
print STDERR "DNSMASQ-ReSScript: Quiting, no configuration change\n";
exit;
}
my $runStatus = `/etc/init.d/dnsmasq status`;
if( $runStatus =~ /started/i ) {
print STDERR "DNSMASQ-ReSScript: Restarting services\n";
system "/etc/init.d/dnsmasq restart";
}else{
print STDERR "DNSMASQ-ReSScript: Quiting, Dnsmasq not running\n";
exit;
}
### Change Log ###
# v1.0 - 11-24-08 - Initial script
# v1.1 - 07-09-09 - Bug fix, if /etc/hosts.live file didn't exist the script would quit without restarting the services or copying /etc/hosts to /etc/hosts.live%
#!/bin/bash
source /etc/init.d/functions.sh
ebegin "Connecting to the VPN"
sudo INTERNAL_IP4_DNS=127.0.0.1 vpnc
eend
#ebegin "Modifying the routing table"
#route add default gw 192.168.0.1
#route add -net 172.25.230.0 netmask 255.255.255.0 dev tun0
#route add -net 192.168.160.0 netmask 255.255.255.0 dev tun0
#route add -net 192.168.125.0 netmask 255.255.255.0 dev tun0
#eend
einfo "Press any key to disconnect ..."
read $disconnect
ebegin "Disconnecting from the VPN"
sudo vpnc-disconnect
eend
#ebegin "Reconfiguring the default routing table"
#route add default gw 192.168.0.1
#eend
einfo "VPN should now be disconnected"
[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
; Phone = <Target Phone Number>
Phone = *99#
ISDN = 0
; Username = <Your Login Name>
Username = 3gnet
Password = 3gnet
Init1 = ATZ
;Init1 = 3gnet
; Password = <Your Password>
Modem = /dev/ttyUSB0
Baud = 9600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment