Linux

For quick answers to quick questions on whatever subject you need!

Moderator: Thought Police

Locked
spikyspud
Epsilon-Minus
Epsilon-Minus
Posts: 51
Joined: Fri Jan 16, 2004 1:06 am
Location: Lancs Uni

Linux

Post by spikyspud »

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)
Kajun
World Controller
World Controller
Posts: 10412
Joined: Tue Jan 22, 2002 12:00 am
Location: Hear.
Contact:

Post by Kajun »

'fraid not spiky, unless it involves breaking it.
Kajun is awaiting approval.
Bat
Regional Controller
Regional Controller
Posts: 2987
Joined: Tue Mar 05, 2002 8:09 pm

Post by Bat »

I know a fair bit, by no means a pro though.
spikyspud
Epsilon-Minus
Epsilon-Minus
Posts: 51
Joined: Fri Jan 16, 2004 1:06 am
Location: Lancs Uni

Post by spikyspud »

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!!!



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
Bat
Regional Controller
Regional Controller
Posts: 2987
Joined: Tue Mar 05, 2002 8:09 pm

Post by Bat »

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
Bat
Regional Controller
Regional Controller
Posts: 2987
Joined: Tue Mar 05, 2002 8:09 pm

Post by Bat »

Boss also says: -

you will have to also add the line

export DISPLAY=0.0

if you have no other mechanism for this (I think you will need this as
the default bash script will have no variable set and just run vanilla
). else xine won't know where to open and pooh its pants
willo da wisp
Gamma-Freemartin
Gamma-Freemartin
Posts: 482
Joined: Thu Jan 08, 2004 8:55 am

Post by willo da wisp »

Response from friend and Linux fan...
I 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.
Followed by
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?
And finally...
Dump xine and check out mplayer
I have no idea what any of it means, but here's hoping it helps!
spikyspud
Epsilon-Minus
Epsilon-Minus
Posts: 51
Joined: Fri Jan 16, 2004 1:06 am
Location: Lancs Uni

Post by spikyspud »

Thanks for the help guys, but unfortunately the problem still dogs me :cry:
Locked