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”