Anyone know a decent (bearing in mind I am newbie) amount about Linux??
(Thought I would check before I spend 30 mins typing out the question)
Linux
Moderator: Thought Police
Worth a try anyway!
I have a shell script (see below) that I run every hour with good old cronjob, now cronjob runs the script fine except one line, the one stared. The stared line works when running it from a shell.
Now have tried everything I know of to get it to work like preceding the line with exec trying to force the shell type to interactive, all to no avail. So does anyone know why cronjob wont run that line and even better how I can get it to run? Anyone who can answer this I will owe big time!!!
I have a shell script (see below) that I run every hour with good old cronjob, now cronjob runs the script fine except one line, the one stared. The stared line works when running it from a shell.
Now have tried everything I know of to get it to work like preceding the line with exec trying to force the shell type to interactive, all to no avail. So does anyone know why cronjob wont run that line and even better how I can get it to run? Anyone who can answer this I will owe big time!!!
Code: Select all
#! /bin/bash
if cmp $1 $2
then
echo "do nothing"
else
echo "do the following"
killall xine
cp file1.txt file2.txt
**//usr/bin/xine**
fi
Opinions from resident Oxford Debian gurus
Student wrote: xine is I think going to not only need interactive mode, but probably
will want a graphical interface (eg. X11) to work. I think what you
probably want to do is to use xine-remote to control an already running
xine rather than the killall xine followed by xine. I may be completely
wrong here, but I think thats probably the easiest way to do what you want.
My Boss wrote: try
/usr/bin/xine &
so that the program fork and runs as new process
you may need a redirector on stderr to so try adding
2>&1 >/dev/null
to the end
-
- Gamma-Freemartin
- Posts: 482
- Joined: Thu Jan 08, 2004 8:55 am
Response from friend and Linux fan...
Followed byI would replace the line
//usr/bin/xine
with
/usr/bin/xine &
otherwise the shell script will kind of sit there forever and maybe
annoy cron.
The second / is totally superfluous unless there's some werid bash
thing that I don't understand. My first reaction was to preceed the line
with exec but it appears he's tried that one.
And finally...One other point would be to check who (which user) the script is being
run as. Does whichever user (or pseudouser) have permission to open up
something on the X server? As long as the script's being run by hand by
the same user who's logged in to X, it shouldn't be a problem, but if
the script is part of a larger thing then it might become an issue. In
many Linux distros, root won't by default have access to open programs
in an X session owned by a user - so that may be worth checking out. Is
there an error message of any kind? Anything in syslog?
I have no idea what any of it means, but here's hoping it helps!Dump xine and check out mplayer