Archive for the tag 'Setup'

How to setup a cron job

This tutorial covers how to setup a Cron job. Cron is a service for executing scheduled commands.

It assumes you have first logged into Virtualmin.

Click Webmin on the top-left.

Click Services.

Click Scheduled Cron Jobs.

Click Create a new scheduled cron job.

Choose the user to run as, and input the username in Execute cron job as. To run as the administrative user, input root .

Enter the command to run into the Command field. For example, if you want to receive a list of all running processes, enter ps auxw for the command.

Normally, you can skip Input to command. That’s only used if your command requires input after it begins running.

Choose how frequently to run your command. By default, it will execute Hourly, meaning it will execute at the top of the hour, every hour.

To enable the Cron job, click Create.

Any output will be emailed to the root user.

SBDavid

Setup wvdial to dial your ISP

Setup wvdial to dial your ISP

If you are using a dial-up internet connection, then you may configure your linux box to connect to the internet as discussed below.

Before you attempt to get dial-on-demand working, you need to make sure that you can dial up your ISP.
If this is the first time you are connecting to the internet, then you have to ’su’ to root and execute the ‘wvdialconf’ script. This would build a configuration file for wvdial. It detects your modem, its maximum baud rate, and a good initialization string and generates or updates the wvdial configuration file based on this information.

bash$ wvdialconf /etc/wvdial.conf
Scanning your serial ports for a modem.

ttyS0: ATQ0 V1 E1 — failed with 2400 baud, next try: 4800 baud
ttyS0: ATQ0 V1 E1 — OK
ttyS0: ATQ0 V1 E1 Z — OK
ttyS0: ATQ0 V1 E1 S0=0 — OK
ttyS0: ATQ0 V1 E1 S0=0 &C1 — OK
ttyS0: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyS0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — ERROR
ttyS0: Modem Identifier: ATI — 128K
ttyS0: Speed 9600: AT — OK
ttyS0: Speed 19200: AT — OK
ttyS0: Speed 38400: AT — OK
ttyS0: Speed 57600: AT — OK
ttyS0: Speed 115200: AT — OK
ttyS0: Max speed is 115200; that should be safe.
ttyS0: ATQ0 V1 E1 S0=0 &C1 &D2 — OK

Found a modem on /dev/ttyS0.
/etc/wvdial.conf: Can’t read config file /etc/wvdial.conf:
No such file or directory
Modem configuration written to /etc/wvdial.conf.
ttyS0: Speed 115200; init “ATQ0 V1 E1 S0=0 &C1 &D2″

This will produce the configuration file /etc/wvdial.conf having entries such as:-

[Dialer Defaults]
Modem = /dev/ttyS0
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
ISDN = 0
Modem Type = Analog Modem
; Phone =
; Username =
; Password =

You can now fill in your ISP’s phone number, your username and password. You should now be able to run wvdial and connect to the Internet. Type wvdial and you should see several lines scroll past and will stop after starting pppd. To stop the connection, press - C.

You may re-arrange your wvdial.conf to separate the modem configuration from any ISP account details.

[dialer defaults]
Init1 = ATZ
Init2 = AT+CRM = 1
ISDN = 0
Modem = /dev/ttyACM0
Baud = 460800
Flow control = Hardware (CRTSCTS)
Carrier check = no
Dial command = ATDT
SetVolume = 0

[Dialer ABC]
Phone = #12345
Username = xxxxx
Password = xxxxx

Suppose your service provider is ABC, you may configure the username and password to dial the phone number 12345 as shown above.

Now, you may execute the following command to connect to the internet:-

bash-3.1$ sudo wvdial ABC

You may find output such as:-

bash-3.1$ sudo wvdial ABC
WvDial: Internet dialer version 1.56 (abuild@mandelbrot)
Cannot get information for serial port.
Initializing modem.
Sending: ATZ
ATZ
OK
Sending: AT+CRM = 1
AT+CRM = 1
OK
Modem initialized.
Sending: ATDT#12345
Waiting for carrier.
ATDT#12345
CONNECT
Carrier detected. Waiting for prompt.
Don’t know what to do! Starting pppd and hoping for the best.
Starting pppd at Sat Apr 5 23:35:36 2008
Pid of pppd: 5037
Using interface ppp0

The above method should work fine for other Linux distros with slight modification.

« Prev