SHARE
TWEET

pdmenurc sysadmin

a guest Apr 10th, 2014 249 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/pdmenu
  2.  
  3. ## Version:     2012-03-03
  4. ## Mods:        
  5. ## By:          Digital Foundations
  6. ## License:     GPL
  7. ## Uses:        mc, dialog, ncdu
  8. ##
  9. ## Changelog:   3/3  - date, netselect, bridge status,sudo iptables
  10. ##              23/2 - cron, services
  11. ##              21/2 - dmidecode
  12. ##              19/2 - exim4
  13. ##              18/2 - Hardware, apt-get force install
  14. ##              11/2 - network listen ports
  15. ##              10/2 - apt-get autoremove
  16. ##              2/2  - iptables
  17. ##              29/1 - wol
  18. ##
  19. ## This menu is designed to give quick access to regular
  20. ## repetative tasks performed in the Linux (Debian) console.
  21. ##
  22. # Save this file in /usr/local/bin
  23. # and chmod ugo+x /usr/local/bin/pdmenu.main
  24. #
  25. # Pdmenu does not script well on it's own so if you need to
  26. # set environment variables, suggest you make a script
  27. # /usr/local/bin/menu
  28. # and use that to initialize variables before calling pdmenu.main
  29. #
  30. #Set a pleasing color scheme.
  31.         color:desktop:blue:blue
  32.         color:title:white:white        
  33.         color:base:white:white
  34.  
  35.         menu:main:Main Menu
  36.         show:_Apps...::apps
  37.         show:_Debian Menus..::/Debian
  38.         show:_Filesystem..::filesystem
  39.         preproc:if [ -f ~/.pdmenurc ]; then echo "exec:_MyMenu::pdmenu ~/.pdmenurc"; fi
  40.         show:_System::system
  41.         nop
  42.         show:_Help::help
  43.         exec:_Edit menu::sudo nano /usr/local/bin/pdmenu.main
  44.         exit:E_xit
  45.  
  46. menu:apps::Applications
  47.         preproc:if [ -f /usr/bin/alpine ]; then echo "exec:_Alpine mail::alpine"; fi
  48.         preproc:if [ -f /usr/local/bin/pdmenu.apache ]; then echo "exec:_Apache::pdmenu /usr/local/bin/pdmenu.apache"; fi
  49.         preproc:if [ -f /usr/local/bin/pdmenu.avahi ]; then echo "exec:_Avahi::pdmenu /usr/local/bin/pdmenu.avahi"; fi
  50.         preproc:if [ -f /usr/local/bin/pdmenu.dns ]; then echo "exec:_DNS::pdmenu /usr/local/bin/pdmenu.dns"; fi
  51.         preproc:if [ -f /usr/local/bin/pdmenu.exim4 ]; then echo "exec:_Exim::pdmenu /usr/local/bin/pdmenu.exim4"; fi
  52.         preproc:if [ -f /usr/local/bin/pdmenu.lxc ]; then echo "exec:_LXC::pdmenu /usr/local/bin/pdmenu.lxc"; fi
  53.         preproc:if [ -f /usr/bin/lynx ]; then echo "exec:_Lynx Internet browser::lynx"; fi
  54.         preproc:if [ -f /usr/local/bin/pdmenu.mysql ]; then echo "exec:_Mysql::pdmenu /usr/local/bin/pdmenu.mysql"; fi
  55.         preproc:if [ -f /usr/local/bin/pdmenu.ntp ]; then echo "exec:_NTP::pdmenu /usr/local/bin/pdmenu.ntp"; fi
  56.         preproc:if [ -f /usr/local/bin/pdmenu.postfix ]; then echo "exec:_Postfix::pdmenu /usr/local/bin/pdmenu.postfix"; fi
  57.         preproc:if [ -f /usr/local/bin/pdmenu.samba4 ]; then echo "exec:_Samba4::pdmenu /usr/local/bin/pdmenu.samba4"; fi
  58.         preproc:if [ -f /usr/local/bin/pdmenu.smb ]; then echo "exec:_Samba3::pdmenu /usr/local/bin/pdmenu.smb"; fi
  59.         preproc:if [ -f /usr/local/bin/pdmenu.squid ]; then echo "exec:_Squid::pdmenu /usr/local/bin/pdmenu.squid"; fi
  60.         preproc:if [ -f /usr/local/bin/pdmenu.ssh ]; then echo "exec:_SSH::pdmenu /usr/local/bin/pdmenu.ssh"; fi
  61. #       exec:_SSH:edit:ssh ~Username?:~@~Host?:~ -p ~Port?:22~
  62. menu:filesystem:Filesystem
  63.         exec:_df:p:df
  64.         exec:_du:p:du
  65.         exec:_ncdu::ncdu
  66.         exec:_mc::mc
  67.         exec:sudo mc::sudo mc
  68. menu:system:System
  69.         show:_apt (package mgmt)::apt
  70.         exec:_cron (scheduled tasks):p:crontab -e
  71.         show:_Date & Time::date_menu
  72.         show:_Hardware...::hardware
  73.         show:_Networking...::networking
  74.         group:_Services..
  75.          exec::makemenu: \
  76.           echo "menu:make_svcs:Services:Select a service..."; \
  77.           for I in `ls /etc/init.d `; do \
  78.           echo "exec:_$I::export SERVICE=$I; pdmenu /usr/local/bin/pdmenu.main --menu=services"; \
  79.           done
  80.          show:::make_svcs
  81.          remove:::make_svcs
  82.          endgroup
  83.         show:_Performance..::performance
  84.         show:_User settings..::user_settings
  85.         show:_Users & Groups..::users_groups
  86.         exec:_Who's online?:truncate:echo "These users are online:";w
  87.  menu:apt:Apt
  88.         exec:apt-get _autoremove:p:sudo apt-get autoremove
  89.         exec:_apt-get update:p:sudo apt-get update
  90.         exec:_apt-get upgrade:p:sudo apt-get upgrade
  91.         exec:_apt-get install:edit,p:sudo apt-get install ~Package?:~
  92.         exec:_apt-get force install:disp:echo "Go to /var/cache/apt/archives and force the deb install using dpkg -i --force-depends <package>"
  93.         exec:_apt-get purge:edit,p:sudo apt-get purge ~Package?:~
  94.         exec:_apt-get remove:edit,p:sudo apt-get remove ~Package?:~
  95.         exec:_aptitude search:edit,p:aptitude search ~Package?:~
  96.         exec:_apt-get simulate:edit,disp:apt-get -s install ~Package?:~ | more
  97.         exec:_netselect-apt:p:sudo netselect-apt
  98.         exec:_Sources::nano /etc/apt/sources.list
  99.         nop:-----
  100.         show:_Help::apt-help
  101.   menu:apt-help:Help
  102.         exec:_man apt-get::man apt-get
  103.         exec:_man aptitude::man aptitude
  104.         exec:_man sources.list::man sources.list
  105.  menu:date_menu:Date & Time
  106.         exec:_Date & time:disp:date
  107.         exec:_Timezone:disp:cat /etc/timezone
  108.         exec:_Edit timezone:dpkg --reconfigure date
  109.         exec:_NTP:disp:echo Not implemented yet.
  110.  menu:hardware:Hardware
  111.         exec:_PCI devices (lspci):disp:lspci
  112.         exec:_SMBIOS (dmidecode):disp:dmidecode -q
  113.         exec:_USB devices (lsusb):disp:lsusb
  114.  menu:networking:Networking
  115.         exec:_Bridge status:disp:sudo brctl show
  116.         exec:_Configure::sudo nano /etc/network/interfaces
  117.         group:_Interfaces..
  118.          exec::makemenu: \
  119.           echo "menu:make_int:Interfaces:Select an interface..."; \
  120.           for I in `ip addr | grep mtu | awk -F ": " '{print $2}' `; do \
  121.           echo "exec:_$I::export INTERFACE=$I; pdmenu /usr/local/bin/pdmenu.main --menu=interfaces"; \
  122.           done
  123.          show:::make_int
  124.          remove:::make_int
  125.          endgroup
  126.         preproc:if [ -f /usr/local/bin/pdmenu.iptables ]; then echo "exec:_Iptables..::sudo pdmenu /usr/local/bin/pdmenu.iptables"; fi
  127.         exec:_Listening ports(ss):p:ss -all | more
  128.         show:_Routing..::routing
  129.         show:_Tools..::network-tools
  130.         exec:_Status (all):display:ip addr
  131.         exec:_Restart all:p:sudo /etc/init.d/networking restart
  132.         preproc:if [ -f /usr/local/bin/pdmenu.pptp ]; then echo "exec:_PPTP::pdmenu /usr/local/bin/pdmenu.pptp"; fi
  133.         nop
  134.         show:_Help::network-help
  135.   preproc:echo "menu:interfaces:$INTERFACE:Select a task..."
  136.         exec:_ifdown..:edit,p:sudo ifdown $INTERFACE
  137.         exec:_ifup..:edit,p:sudo ifup $INTERFACE
  138.         exec:_ifdown,ifup:p:sudo ifdown $INTERFACE; sleep 1; sudo ifup $INTERFACE
  139.         exec:_Status:disp:ip addr show dev $INTERFACE
  140.  menu:routing:Routing:Select
  141.         exec:_ip route:disp:ip route
  142.  menu:network-tools:Tools
  143.         exec:_nslookup::nslookup
  144.         exec:_ping..:edit:ping ~Host:8.8.8.8~
  145.         exec:_telnet:edit:telnet ~Host?:~ ~Port?:~
  146.  menu:network-help:Help
  147.         exec:man _interfaces::man interfaces
  148.         exec:man i_p::man ip
  149. menu:performance:Performance:Performance
  150.         preproc:if [ -f /usr/bin/atop ]; then echo "exec:_atop::sudo atop"; fi
  151.         preproc:if [ -f /usr/bin/htop ]; then echo "exec:_htop::sudo htop"; fi
  152.         exec:_top::top
  153. preproc:echo "menu:services:$SERVICE:Select"
  154.         exec:_Status:disp:/etc/init.d/$SERVICE status
  155.         exec:_Start:p:/etc/init.d/$SERVICE start
  156.         exec:_Stop:p:/etc/init.d/$SERVICE stop
  157.         exec:_Restart:p:/etc/init.d/$SERVICE restart
  158.         exec:_Help::man $SERVICE
  159.         exec:_Info:disp:cat /etc/init.d/$SERVICE | grep "#"
  160. menu:user_settings:User settings
  161.         exec:._bashrc::nano ~/.bashrc
  162.         exec:_Change your password:p:passwd
  163.         exec:_Directory listing:display:ls -l ~
  164. menu:users_groups:Users & Groups
  165.         exec:_list users:display:sort /etc/passwd
  166.         exec:_list groups:display:sort /etc/group
  167.         exec:_add user to group:edit,pause:sudo adduser ~USER:~ ~GROUP:~
  168.         group:_Manage a user
  169.          exec::makemenu: \
  170.           echo "menu:select_user:Select a user"; \
  171.           sort /etc/passwd | awk -F ":" '{print "exec:" $1 ":disp:echo Not implemented yet."}'
  172.           show:::select_user
  173.           remove:::select_user
  174.         endgroup
  175.         exec:_sudo users:pause:sudo visudo
  176. menu:help:Help
  177.         exec:_About:disp:grep "^##" /usr/local/bin/pdmenu.main
  178.         exec:_man page...:edit:man ~Topic?:~
  179.  
  180. # If you edit this file, you will probably not want to remove the following
  181. # section, which makes menus of Debian apps available.
  182. preproc: \
  183.         if tty|egrep -q "tty[0-9]|vc/[0-9]|console"; then       \
  184.                 cat /var/lib/pdmenu/pdmenurc.vc;                \
  185.         elif [ "$DISPLAY" ]; then                               \
  186.                 cat /var/lib/pdmenu/pdmenurc.x11;               \
  187.         else                                                    \
  188.                 cat /var/lib/pdmenu/pdmenurc;                   \
  189.         fi
  190.  
  191.             nop
  192.             exit:_Back to main menu..
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top