Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Quick overview, I have created a script that reboots the laptop after x amount of time and x amount of cycles. I have added the script to the start-up applications and the script does seem to be running in the background but never opens a terminal Window. Am I missing something?

Adding Code (this is saved in a file called


# check if passed.txt exists if it does, send to soak test

if [ -f passed.txt ];
echo reboot has passed $nol cycles
sleep 5;
echo Starting soak tests 
sleep 5;
rm testlog.txt;
rm passed.txt;
phoronix-test-suite run quick-test
exit 0;

# check if file testlog.txt exists if not create it

if [ ! -f testlog.txt ];
echo >> testlog.txt;

# read reboot file to see how many loops have been completed

exec < testlog.txt
while read line
nol=`expr $nol + 1`

# start the countdown, x is time limit

let x=10; 
while [ $x -gt 0 ]; 
do clear; 
figlet "Rebooting in..."; 
figlet $x; 
let x-=1; 
sleep 1;
echo reboot success $nol >> testlog.txt;
shutdown -r now;

# set how many times the script should shutdown the laptop


# if number of reboots matches nol's then stop the script
# create a new text file called passed.txt

if [ "$nol" == "$reboot_count" ];
echo reboot passed $nol cycles >> passed.txt;
share|improve this question
Get the number of lines with nol=$(wc -l testlog.txt) – artistoex Sep 11 '12 at 9:18
up vote 1 down vote accepted

shell scripts don't automatically open windows on your desktop. You have to include code to do that if that is what you want.

Update 1

One way to do this is to use Xdialog.

Note you may need to install it using sudo yum install Xdialog or apt-get install Xdialog (or whatever command is appropriate for your Unix/Linux distribution's package manager).

There are examples in /usr/share/doc/xdialog*/samples, here's one

Using this tool you can have the background script display messages on the system console (assuming it is running an X server). You may have to set the value of the DISPLAY environment variable so the program knows on which screen it should display the dialog. This also works for remote PCs etc if they run an X server (e.g. Xming on Windows).

Heres a quick example

Xdialog test

Update 2

Note: the above is not the usual way a system background task communicates with users. Normally I'd just have the task write it's messages to a log file (and maybe use logger to write to syslog), then anyone who is interested can just use tail -f logfilename to see current status of the background process.

If you need to bring to someone's attention the completion of a task you might instead send them an e-mail or trigger an SNMP alert.

share|improve this answer
Hi RedGritty would I write such code in the actual shell script? I'm guessing this would work as the script is actually being run just not showing a window? Or would it need to go into an external file that runs on start-up? – twigg Sep 11 '12 at 9:23
@twigg: I'll update answer – RedGrittyBrick Sep 11 '12 at 9:24
@twigg start an X-Server – artistoex Sep 11 '12 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .