Linux System Administration

I know that there is a syntax in a rtorrent config file to schedule throttle for uploads and download for rtorrent. However, no matter how hard I tried I did not work for my N2100 NAS device. The only value in regards to throttle uploads and downloads I can control is a global download_rate and upload_rate variable. So I came with a simple hack to use a crontab to stop , change config and start rtorrent. I have created two config files: one for offpeak and another for peak time. Once done edited a cron tast with
crontab -e
and add these lines:

00 7 * * * /raid/module/cfg/module.rc/RTORRENT.rc stop
01 7 * * * cp /root/rtorrent.rc_peak /raid/module/RTORRENT/system/etc/rtorrent.rc
02 7 * * * /raid/module/cfg/module.rc/RTORRENT.rc start

57 0 * * * /raid/module/cfg/module.rc/RTORRENT.rc stop
58 0 * * * cp /root/rtorrent.rc_offpeak /raid/module/RTORRENT/system/etc/rtorrent.rc
59 0 * * * /raid/module/cfg/module.rc/RTORRENT.rc start

Every process which starts from a terminal is tied to shell as a child process from which it was executed. In the situation when a parent program gets terminated the child process will be terminated also as a result parent process termination.

This is not particularity desired behavior when a user needs to run a process remotely and let the process run after logout. Fir this reason a nohup command exists. nohp ensures that the process is not tied to any particular shell so user can kill shell process by logging out and the process executed with nohup will be kept alive. Syntax for nohup is as follows:

$ nohup my-command > my-command.out &

Note the output file will be created as this will capture any STDOUT coming out from my-command. & returns a shell as it runs my-command on the background. Here is a small example to test this theory:

Run a yes command with nohup and redirect a output to the /dev/null. Make sure that you use & at the end of the command to run the command on the background:

$ nohup yes > /dev/null &
[1] 3594

now close or log out from the terminal, open another session and run a following command:

ps aux | grep yes
lilo 3594 98.3 0.0 3016 504 ? R 11:06 1:23 yes

Note that process PID 3594 is still running. To kill that process run:

kill 3594

If you wish to synchronize your system time with a world time servers all you need to do is to install a ntpdate utility and issue a following command as a root user and you are done:

# ntpdate

The above command will synchronize your system time / clock. However, if you want to stay synchronized you need to do little bit more work. The work involves installation and configuration of NTPD daemon. NTPD uses NTP ( network time protocol ) to access a specified time server over the internet. Later, it will keep your system time synchronized without your further intervention.

First we need to install NTPD service. On Debian or Ubuntu this step is easy as:

# apt-get install ntp

In most cases your NTP Daemon will be configured out of the box and installation of ntp package is all you would ever need to do to keep your system time synchronized with internet standard time servers. However, it is good to check certain settings whether they are in place before we leave a system time in hands of NTP daemon. The absolute bare configuration is:

driftfile - this file is used by a ntp daemon to store a clock drift / synchronization error

Read more ...

Page 61 of 72

Free Linux eBooks

Go to top