分类: LINUX
2012-04-28 11:02:37
| 1 | $ sudo apt-get install libnotify-bin |
| 1 | notify-send "rsnapshot done :)" |
| 1 | .... |
| 2 | alert=18000 |
| 3 | live=$(lynx --dump http://money.rediff.com/ | grep 'BSE LIVE' | awk '{ print $5}' | sed 's/,//g;s/\.[0-9]*//g') |
| 4 | [ $notify_counter -eq 0 ] && [ $live -ge $alert ] && { notify-send -t 5000 -u low -i "BSE Sen*** touched 18k"; notify_counter=1; } |
| 5 | ... |
| 01 | #!/bin/bash |
| 02 |
| 03 | # clear the screen |
| 04 | tput clear |
| 05 |
| 06 | # Move cursor to screen location X,Y (top left is 0,0) |
| 07 | tput cup 3 15 |
| 08 |
| 09 | # Set a foreground colour using ANSI escape |
| 10 | tput setaf 3 |
| 11 | echo "XYX Corp LTD." |
| 12 | tput sgr0 |
| 13 |
| 14 | tput cup 5 17 |
| 15 | # Set reverse video mode |
| 16 | tput rev |
| 17 | echo "M A I N - M E N U" |
| 18 | tput sgr0 |
| 19 |
| 20 | tput cup 7 15 |
| 21 | echo "1. User Management" |
| 22 |
| 23 | tput cup 8 15 |
| 24 | echo "2. Service Management" |
| 25 |
| 26 | tput cup 9 15 |
| 27 | echo "3. Process Management" |
| 28 |
| 29 | tput cup 10 15 |
| 30 | echo "4. Backup" |
| 31 |
| 32 | # Set bold mode |
| 33 | tput bold |
| 34 | tput cup 12 15 |
| 35 | read -p "Enter your choice [1-4] " choice |
| 36 |
| 37 | tput clear |
| 38 | tput sgr0 |
| 39 | tput rc |
| 1 | setleds -D +num |
| 1 | setleds -D -num |
| 01 | #!/bin/bash |
| 02 | # Get domain name |
| 03 | _zenity="/usr/bin/zenity" |
| 04 | _out="/tmp/whois.output.$$" |
| 05 | domain=$(${_zenity} --title "Enter domain" \ |
| 06 | --entry --text "Enter the domain you would like to see whois info" ) |
| 07 |
| 08 | if [ $? -eq 0 ] |
| 09 | then |
| 10 | # Display a progress dialog while searching whois database |
| 11 | whois $domain | tee >(${_zenity} --width=200 --height=100 \ |
| 12 | --title="whois" --progress \ |
| 13 | --pulsate --text="Searching domain info..." \ |
| 14 | --auto-kill --auto-close \ |
| 15 | --percentage=10) >${_out} |
| 16 |
| 17 | # Display back output |
| 18 | ${_zenity} --width=800 --height=600 \ |
| 19 | --title "Whois info for $domain" \ |
| 20 | --text-info --filename="${_out}" |
| 21 | else |
| 22 | ${_zenity} --error \ |
| 23 | --text="No input provided" |
| 24 | fi |
| 1 | kdialog --dontagain myscript:nofilemsg --msgbox "File: '~/.backup/config' not found." |
| 01 | >#!/bin/bash |
| 02 | dialog --title "Delete file" \ |
| 03 | --backtitle "Linux Shell Script Tutorial Example" \ |
| 04 | --yesno "Are you sure you want to permanently delete \"/tmp/foo.txt\"?" 7 60 |
| 05 |
| 06 | # Get exit status |
| 07 | # 0 means user hit [yes] button. |
| 08 | # 1 means user hit [no] button. |
| 09 | # 255 means user hit [Esc] key. |
| 10 | response=$? |
| 11 | case $response in |
| 12 | 0) echo "File deleted.";; |
| 13 | 1) echo "File not deleted.";; |
| 14 | 255) echo "[ESC] key pressed.";; |
| 15 | esac |
| 1 | logger "MySQL database backup failed." |
| 2 | tail -f /var/log/messages |
| 3 | logger -t mysqld -p daemon.error "Database Server failed" |
| 4 | tail -f /var/log/syslog |
| 1 | setterm -blank 15 -powersave powerdown -powerdown 60 |
| 1 | setterm -underline on; |
| 2 | echo "Add Your Important Message Here" |
| 3 | setterm -underline off |
| 1 | setterm -cursor off |
| 1 | smbclient -M WinXPPro < |
| 2 | Message 1 |
| 3 | Message 2 |
| 4 | ... |
| 5 | .. |
| 6 | EOF |
| 1 | echo "${Message}" | smbclient -M salesguy2 |
| 1 | # find out if TCP port 25 open or not |
| 2 | (echo >/dev/tcp/localhost/25) &>/dev/null && echo "TCP port 25 open" || echo"TCP port 25 close" |
| 1 | echo "Scanning TCP ports..." |
| 2 | for p in {1..1023} |
| 3 | do |
| 4 | (echo >/dev/tcp/localhost/$p) >/dev/null 2>&1 && echo "$p open" |
| 5 | done |
| 01 | #!/bin/bash |
| 02 | exec 3<> /dev/tcp/${1:-www.cyberciti.biz}/80 |
| 03 |
| 04 | printf "GET / HTTP/1.0\r\n" >&3 |
| 05 | printf "Accept: text/html, text/plain\r\n" >&3 |
| 06 | printf "Accept-Language: en\r\n" >&3 |
| 07 | printf "User-Agent: nixCraft_BashScript v.%s\r\n" "${BASH_VERSION}" >&3 |
| 08 | printf "\r\n" >&3 |
| 09 |
| 10 | while read LINE <&3 |
| 11 | do |
| 12 | # do something on $LINE |
| 13 | # or send $LINE to grep or awk for grabbing data |
| 14 | # or simply display back data with echo command |
| 15 | echo $LINE |
| 16 | done |
| 1 | @hourly DISPLAY=:0.0 /home/vivek/scripts/monitor.stock.sh |