http://ubuntuforums.org/showthread.php?t=308130
http://kb.mozillazine.org/Register_protocol#Linux_and_Mac
1) Type about:config into the address bar and press Enter.
* Right-click -> New -> Boolean -> Name: network.protocol-handler.external.magnet -> Value -> true
* Right-click -> New -> String -> Name: network.protocol-handler.app.magnet -> Value -> /usr/local/bin/transmission
* Ensure network.protocol-handler.expose-all is set to true
edit: Turns out Transmission supports DHT but not magnet links yet. Maybe Transmission 1.8 will.
Wednesday, November 18, 2009
Saturday, February 21, 2009
Thursday, January 22, 2009
How to execute a sudo command in a script
The -S option for sudo makes sudo read the password from stdin instead of prompting. So it would look something like:
echo 'password' | sudo -S thecmd
Another option is to modify /etc/sudoers to specify NOPASSWD for certain users. Edit /etc/sudoeres with visudo. Then add the line
username ALL=(ALL) NOPASSWD: ALL
where username is the user to set.
echo 'password' | sudo -S
Another option is to modify /etc/sudoers to specify NOPASSWD for certain users. Edit /etc/sudoeres with visudo. Then add the line
username ALL=(ALL) NOPASSWD: ALL
where username is the user to set.
How to copy files from a samba share from the command line
1) Mount the samba share. The command will look something like:
sudo mount -t cifs //servername/dir /home/username/mountdir -o password=password user=username
The -t option specifies the filesystem (cifs = samba). The servername/dir is the remote directory to mount and the /home/username is the local directory to mount to.
Note: smbfs needs to be installed for this to work: sudo apt-get smbfs
To learn more options, read man mount.cifs.
2) Copy files.
3) Unmount samba share:
sudo umount /home/username/mountdir
sudo mount -t cifs //servername/dir /home/username/mountdir -o password=password user=username
The -t option specifies the filesystem (cifs = samba). The servername/dir is the remote directory to mount and the /home/username is the local directory to mount to.
Note: smbfs needs to be installed for this to work: sudo apt-get smbfs
To learn more options, read man mount.cifs.
2) Copy files.
3) Unmount samba share:
sudo umount /home/username/mountdir
Friday, September 19, 2008
scheduling a task to automatically run using cron
To get cron to automatically run something, it must be listed in a crontab file. Each user has his own crontab file. To edit a user's crontab file, use the command crontab -e (a crontab file will be created if none exists).
An entry in a crontab file looks like this:
m h dom mon dow command
where m = minutes, h = hours, dom = day of month, mon = month, and dow = day of week. cron will automatically run the specified command whenever the time matches the specified time. To indicate "any", use an asterisk (*). So to get something to run at 5pm every day, you would add the following line to your crontab file:
00 17 * * * cmd-name
Make sure to use crontab -e to edit your crontab file. The actual files are stored in /var/spool/cron/crontabs/, but you shouldn't edit those files directly.
Pasted from wikipedia:
An entry in a crontab file looks like this:
m h dom mon dow command
where m = minutes, h = hours, dom = day of month, mon = month, and dow = day of week. cron will automatically run the specified command whenever the time matches the specified time. To indicate "any", use an asterisk (*). So to get something to run at 5pm every day, you would add the following line to your crontab file:
00 17 * * *
Make sure to use crontab -e to edit your crontab file. The actual files are stored in /var/spool/cron/crontabs/, but you shouldn't edit those files directly.
Pasted from wikipedia:
# .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | * * * * * command to be executed
Update 2012-08-13: still can't get cron working (Lucid)
This page provided some hints: http://aplawrence.com/Unixart/crontab_not_running.html
/var/log/syslog did not show the cron jobs running
chkconfig --list | grep cron indicated that cron was off:
cron 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Saturday, September 13, 2008
Setting apache web server
Install: sudo apt-get install apache2
Basically followed guidelines here.
The main thing I had to do was to create my own public_html directory, and create an apache config file pointing to it.
1) Create config file at /etc/apache2/sites-available/ (copy /etc/apache2/sites-available/default config file)
2) edit config file to point to created public_html directory
3) create public_html/cgi-bin directory if needed and modify ScriptAlias section of config file to point to created directory
4) disable apache default site: sudo a2dissite default
5) enable new site: sudo a2ensite (verify in /etc/apache2/sites-enabled/)
6) restart apache server: sudo /etc/init.d/apache2 restart
Basically followed guidelines here.
The main thing I had to do was to create my own public_html directory, and create an apache config file pointing to it.
1) Create config file at /etc/apache2/sites-available/ (copy /etc/apache2/sites-available/default config file)
2) edit config file to point to created public_html directory
3) create public_html/cgi-bin directory if needed and modify ScriptAlias section of config file to point to created directory
4) disable apache default site: sudo a2dissite default
5) enable new site: sudo a2ensite
6) restart apache server: sudo /etc/init.d/apache2 restart
Conky system monitor
After briefly looking around for a linux system monitor, I decided to install Conky (over GKrellM and some others).
Getting started is really easy. All I did was copy someone else's .conkyrc file. Check here, here, here, or here.
Conky allows all sorts of customizations. The conky man page is really useful, as is this page describing all the available variables in conky.
Here is what my conky window ultimately looked like:

Here is what my .conkyrc file wound up looking like:
# UBUNTU-CONKY
# A comprehensive conky script, configured for use on
# Ubuntu / Debian Gnome, without the need for any external scripts.
#
# Based on conky-jc and the default .conkyrc.
# INCLUDES:
# - tail of /var/log/messages
# - netstat connections to your computer
#
# -- Pengo (conky@pengo.us)
#
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer none
use_xft yes
xftfont Vera Sans:size=8
# Update interval in seconds
update_interval 3.0
# Minimum size of text area
minimum_size 650
maximum_width 650
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
#font arial
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 3
# border margins
border_margin 9
# border width
border_width 10
# Default colors and also border colors, grey90 == #e5e5e5
default_color grey
own_window_colour brown
own_window_transparent yes
# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 5
gap_y 50
# stuff after 'TEXT' will be formatted on screen
TEXT
${color green}SYSTEM ($sysname $kernel) ${hr 2}$color
Uptime:$color $uptime Load:$color $loadavg $processes processes ($running_processes running) Logged In: $user_number
${color green}CPU (Intel Core2 Quad Q6600 @ $freq_g GHz)${hr 2}$color
CPU Temp: ${platform w83627ehf.656 temp 1}C MB Temp: ${platform w83627ehf.656 temp 2}C CPU Fan: ${platform w83627ehf.656 fan 2} RPM Case Fan: ${platform w83627ehf.656 fan 1} RPM PSU Fan: ${platform w83627ehf.656 fan 3} RPM
${color orange}Core 1:$color${goto 70}${platform coretemp.0 temp 1}C${goto 139}${cpu cpu1}%${goto 175}${color orange}Core 2:$color${goto 240}${platform coretemp.1 temp 1}C${goto 303}${cpu cpu2}%${goto 340}${color orange}Core 3:$color${goto 405}${platform coretemp.2 temp 1}C${goto 468}${cpu cpu3}%${goto 505}${color orange}Core 4:$color${goto 570}${platform coretemp.3 temp 1}C${goto 635}${cpu cpu4}%
${cpugraph cpu1 40,150 000000 ffffff}${goto 175}${cpugraph cpu2 40,150 000000 ffffff}${goto 340}${cpugraph cpu3 40,150 000000 ffffff}${goto 505}${cpugraph cpu4 40,150 000000 ffffff}
${color blue}${goto 80}CPU USAGE${goto 400}MEMORY USAGE$color
NAME${goto 125}CPU%${goto 175}MEM%${goto 300}NAME${goto 400}MEM%${goto 455}MEM (PHY)${goto 525}MEM (VIRT)
${top name 1}${goto 125}${top cpu 1}${goto 175}${top mem 1}${goto 300}${top_mem name 1}${goto 400}${top_mem mem 1}${goto 455}${top_mem mem_res 1}${goto 525}${top_mem mem_vsize 1}
${top name 2}${goto 125}${top cpu 2}${goto 175}${top mem 2}${goto 300}${top_mem name 2}${goto 400}${top_mem mem 2}${goto 455}${top_mem mem_res 2}${goto 525}${top_mem mem_vsize 2}
${top name 3}${goto 125}${top cpu 3}${goto 175}${top mem 3}${goto 300}${top_mem name 3}${goto 400}${top_mem mem 3}${goto 455}${top_mem mem_res 3}${goto 525}${top_mem mem_vsize 3}
${top name 4}${goto 125}${top cpu 4}${goto 175}${top mem 4}${goto 300}${top_mem name 4}${goto 400}${top_mem mem 4}${goto 455}${top_mem mem_res 4}${goto 525}${top_mem mem_vsize 4}
${top name 5}${goto 125}${top cpu 5}${goto 175}${top mem 5}${goto 300}${top_mem name 5}${goto 400}${top_mem mem 5}${goto 455}${top_mem mem_res 5}${goto 525}${top_mem mem_vsize 5}
${color green}MEMORY / DISK ${hr 2}$color
RAM:${goto 100}$mem / $memmax${goto 285}$memperc%${goto 340}Swap:${goto 450}$swap / $swapmax${goto 620}$swapperc%
${membar 8,300}${goto 340}${swapbar 8,300}
Root:${goto 80}${fs_used /} / ${fs_size /}${goto 220}(${fs_free /} free)${goto 340}Home:${goto 410}${fs_used /home/username/} / ${fs_size /home/username/}${goto 550}(${fs_free /home/username/} free)
${fs_bar 8,300 /}${goto 340}${fs_bar 8,300 /home/username/}
Movies:${goto 75}${fs_used /misc/} / ${fs_size /misc/}${goto 220}(${fs_free /misc/} free)${goto 340}TV:${goto 400}${fs_used /tv/} / ${fs_size /tv/}${goto 550}(${fs_free /tv/} free)
${fs_bar 8,300 /misc/}${goto 340}${fs_bar 8,300 /tv/}
${color green}NETWORK (${addr eth0}) ${hr 2}$color
Down: ${downspeedf eth0} k/s${goto 120}Total: ${totaldown eth0}${goto 240}Inbound: ${tcp_portmon 1 32767 count}${goto 340}Up: ${upspeedf eth0} k/s${goto 450}Total: ${totalup eth0}${goto 560}Outbound: ${tcp_portmon 32768 61000 count}
${downspeedgraph eth0 40,300 000000 ffffff}${goto 340}${upspeedgraph eth0 40,300 000000 ffffff}
Getting started is really easy. All I did was copy someone else's .conkyrc file. Check here, here, here, or here.
Conky allows all sorts of customizations. The conky man page is really useful, as is this page describing all the available variables in conky.
Here is what my conky window ultimately looked like:
Here is what my .conkyrc file wound up looking like:
# UBUNTU-CONKY
# A comprehensive conky script, configured for use on
# Ubuntu / Debian Gnome, without the need for any external scripts.
#
# Based on conky-jc and the default .conkyrc.
# INCLUDES:
# - tail of /var/log/messages
# - netstat connections to your computer
#
# -- Pengo (conky@pengo.us)
#
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer none
use_xft yes
xftfont Vera Sans:size=8
# Update interval in seconds
update_interval 3.0
# Minimum size of text area
minimum_size 650
maximum_width 650
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
#font arial
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 3
# border margins
border_margin 9
# border width
border_width 10
# Default colors and also border colors, grey90 == #e5e5e5
default_color grey
own_window_colour brown
own_window_transparent yes
# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 5
gap_y 50
# stuff after 'TEXT' will be formatted on screen
TEXT
${color green}SYSTEM ($sysname $kernel) ${hr 2}$color
Uptime:$color $uptime Load:$color $loadavg $processes processes ($running_processes running) Logged In: $user_number
${color green}CPU (Intel Core2 Quad Q6600 @ $freq_g GHz)${hr 2}$color
CPU Temp: ${platform w83627ehf.656 temp 1}C MB Temp: ${platform w83627ehf.656 temp 2}C CPU Fan: ${platform w83627ehf.656 fan 2} RPM Case Fan: ${platform w83627ehf.656 fan 1} RPM PSU Fan: ${platform w83627ehf.656 fan 3} RPM
${color orange}Core 1:$color${goto 70}${platform coretemp.0 temp 1}C${goto 139}${cpu cpu1}%${goto 175}${color orange}Core 2:$color${goto 240}${platform coretemp.1 temp 1}C${goto 303}${cpu cpu2}%${goto 340}${color orange}Core 3:$color${goto 405}${platform coretemp.2 temp 1}C${goto 468}${cpu cpu3}%${goto 505}${color orange}Core 4:$color${goto 570}${platform coretemp.3 temp 1}C${goto 635}${cpu cpu4}%
${cpugraph cpu1 40,150 000000 ffffff}${goto 175}${cpugraph cpu2 40,150 000000 ffffff}${goto 340}${cpugraph cpu3 40,150 000000 ffffff}${goto 505}${cpugraph cpu4 40,150 000000 ffffff}
${color blue}${goto 80}CPU USAGE${goto 400}MEMORY USAGE$color
NAME${goto 125}CPU%${goto 175}MEM%${goto 300}NAME${goto 400}MEM%${goto 455}MEM (PHY)${goto 525}MEM (VIRT)
${top name 1}${goto 125}${top cpu 1}${goto 175}${top mem 1}${goto 300}${top_mem name 1}${goto 400}${top_mem mem 1}${goto 455}${top_mem mem_res 1}${goto 525}${top_mem mem_vsize 1}
${top name 2}${goto 125}${top cpu 2}${goto 175}${top mem 2}${goto 300}${top_mem name 2}${goto 400}${top_mem mem 2}${goto 455}${top_mem mem_res 2}${goto 525}${top_mem mem_vsize 2}
${top name 3}${goto 125}${top cpu 3}${goto 175}${top mem 3}${goto 300}${top_mem name 3}${goto 400}${top_mem mem 3}${goto 455}${top_mem mem_res 3}${goto 525}${top_mem mem_vsize 3}
${top name 4}${goto 125}${top cpu 4}${goto 175}${top mem 4}${goto 300}${top_mem name 4}${goto 400}${top_mem mem 4}${goto 455}${top_mem mem_res 4}${goto 525}${top_mem mem_vsize 4}
${top name 5}${goto 125}${top cpu 5}${goto 175}${top mem 5}${goto 300}${top_mem name 5}${goto 400}${top_mem mem 5}${goto 455}${top_mem mem_res 5}${goto 525}${top_mem mem_vsize 5}
${color green}MEMORY / DISK ${hr 2}$color
RAM:${goto 100}$mem / $memmax${goto 285}$memperc%${goto 340}Swap:${goto 450}$swap / $swapmax${goto 620}$swapperc%
${membar 8,300}${goto 340}${swapbar 8,300}
Root:${goto 80}${fs_used /} / ${fs_size /}${goto 220}(${fs_free /} free)${goto 340}Home:${goto 410}${fs_used /home/username/} / ${fs_size /home/username/}${goto 550}(${fs_free /home/username/} free)
${fs_bar 8,300 /}${goto 340}${fs_bar 8,300 /home/username/}
Movies:${goto 75}${fs_used /misc/} / ${fs_size /misc/}${goto 220}(${fs_free /misc/} free)${goto 340}TV:${goto 400}${fs_used /tv/} / ${fs_size /tv/}${goto 550}(${fs_free /tv/} free)
${fs_bar 8,300 /misc/}${goto 340}${fs_bar 8,300 /tv/}
${color green}NETWORK (${addr eth0}) ${hr 2}$color
Down: ${downspeedf eth0} k/s${goto 120}Total: ${totaldown eth0}${goto 240}Inbound: ${tcp_portmon 1 32767 count}${goto 340}Up: ${upspeedf eth0} k/s${goto 450}Total: ${totalup eth0}${goto 560}Outbound: ${tcp_portmon 32768 61000 count}
${downspeedgraph eth0 40,300 000000 ffffff}${goto 340}${upspeedgraph eth0 40,300 000000 ffffff}
Subscribe to:
Posts (Atom)