User Tools

Site Tools


ubuntu

A cron job to install a Debian package, or whatever you need to run that may require a terminal or a permanent terminal:

Initiate screen session:
$ screen -dmS dpkgscreen
Run something in the screen session (and not attaching):
$ screen -x dpkgscreen -X stuff “whatever you need to run \015”
$ screen -x dpkgscreen -X stuff “run something else or respond to a prompt \015 is a return, so if you just need to hit “y”, then leave this off –> \015″
If you want to attach and see what is going on (Multiple people can attach also):
$ screen -x dpkgscreen
“ctrl-a d” to detach and leave the screen session running.
—
cron:
0 * * * * screen -dmS dpkgscreen;sleep 1;screen -x dpkgscreen -X stuff “PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \015”;screen -x dpkgscreen -X stuff “/usr/bin/dpkg -i /path/to/package.deb \015”;sleep 60;screen -x dpkgscreen -X stuff “exit \015”
—
script:
#!/bin/bash
screen -dmS dpkgscreen
sleep 1
screen -x dpkgscreen -X stuff “PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \015″
screen -x dpkgscreen -X stuff “/usr/bin/dpkg -i /path/t \015”
sleep 60
screen -x dpkgscreen -X stuff “exit \015”

Alternatives to screen, tmux is pretty awesome too: http://www.howtogeek.com/114582/2-alternatives-to-gnu-screen-for-linux-terminal-multitasking/


Here are the bare bones service running on ubuntu 12.04 LTS in the Rackspace Cloud:

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 03:30 ?        00:00:00 /sbin/init
root         2     0  0 03:30 ?        00:00:00 [kthreadd]
root         3     2  0 03:30 ?        00:00:00 [ksoftirqd/0]
root         4     2  0 03:30 ?        00:00:00 [kworker/0:0]
root         5     2  0 03:30 ?        00:00:00 [kworker/u:0]
root         6     2  0 03:30 ?        00:00:00 [migration/0]
root         7     2  0 03:30 ?        00:00:00 [watchdog/0]
root         8     2  0 03:30 ?        00:00:00 [cpuset]
root         9     2  0 03:30 ?        00:00:00 [khelper]
root        10     2  0 03:30 ?        00:00:00 [kdevtmpfs]
root        11     2  0 03:30 ?        00:00:00 [netns]
root        12     2  0 03:30 ?        00:00:00 [xenwatch]
root        13     2  0 03:30 ?        00:00:01 [xenbus]
root        14     2  0 03:30 ?        00:00:00 [sync_supers]
root        15     2  0 03:30 ?        00:00:00 [bdi-default]
root        16     2  0 03:30 ?        00:00:00 [kintegrityd]
root        17     2  0 03:30 ?        00:00:00 [kblockd]
root        18     2  0 03:30 ?        00:00:00 [ata_sff]
root        19     2  0 03:30 ?        00:00:00 [khubd]
root        20     2  0 03:30 ?        00:00:00 [md]
root        21     2  0 03:30 ?        00:00:00 [kworker/0:1]
root        22     2  0 03:30 ?        00:00:00 [kworker/u:1]
root        23     2  0 03:30 ?        00:00:00 [khungtaskd]
root        24     2  0 03:30 ?        00:00:00 [kswapd0]
root        25     2  0 03:30 ?        00:00:00 [ksmd]
root        26     2  0 03:30 ?        00:00:00 [fsnotify_mark]
root        27     2  0 03:30 ?        00:00:00 [ecryptfs-kthrea]
root        28     2  0 03:30 ?        00:00:00 [crypto]
root        36     2  0 03:30 ?        00:00:00 [kthrotld]
root        37     2  0 03:30 ?        00:00:00 [khvcd]
root        56     2  0 03:30 ?        00:00:00 [devfreq_wq]
root       168     2  0 03:30 ?        00:00:00 [kjournald]
root       243     1  0 03:30 ?        00:00:00 upstart-udev-bridge --daemon
root       256     1  0 03:30 ?        00:00:00 /sbin/udevd --daemon
syslog     346     1  0 03:30 ?        00:00:00 rsyslogd -c5
102        353     1  0 03:30 ?        00:00:00 dbus-daemon --system --fork --activation=upstart
root       361   256  0 03:30 ?        00:00:00 /sbin/udevd --daemon
root       362   256  0 03:30 ?        00:00:00 /sbin/udevd --daemon
root       420     1  0 03:30 ?        00:00:00 upstart-socket-bridge --daemon
root       647     1  0 03:30 tty4     00:00:00 /sbin/getty -8 38400 tty4
root       655     1  0 03:30 tty5     00:00:00 /sbin/getty -8 38400 tty5
root       662     1  0 03:30 tty2     00:00:00 /sbin/getty -8 38400 tty2
root       664     1  0 03:30 tty3     00:00:00 /sbin/getty -8 38400 tty3
root       669     1  0 03:30 tty6     00:00:00 /sbin/getty -8 38400 tty6
root       676     1  0 03:30 ?        00:00:00 acpid -c /etc/acpi/events -s /var/run/acpid.socket
root       677     1  0 03:30 ?        00:00:00 cron
daemon     678     1  0 03:30 ?        00:00:00 atd
root       707     1  0 03:30 ?        00:00:00 /bin/bash /usr/sbin/xe-daemon -p /var/run/xe-daemon.pid
whoopsie   716     1  0 03:30 ?        00:00:00 whoopsie
root       718     2  0 03:30 ?        00:00:00 [flush-202:0]
root       719     1  0 03:30 ?        00:00:00 /usr/sbin/nova-agent -q -p /var/run/nova-agent.pid -o /var/log/nova-agent.log -l info /usr/share/nova-agent/nova-agent.py
root       754     1  0 03:30 hvc0     00:00:00 /sbin/getty -L hvc0 9600 linux
root       756     1  0 03:30 tty1     00:00:00 /sbin/getty -8 38400 tty1
ubuntu.txt · Last modified: 2016/06/26 12:43 by vinny