LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   DamnSmallLinux (https://www.linuxquestions.org/questions/damnsmalllinux-42/)
-   -   Scripts on digital picture frame running DSL (https://www.linuxquestions.org/questions/damnsmalllinux-42/scripts-on-digital-picture-frame-running-dsl-728673/)

htrboy 05-26-2009 03:27 PM

Scripts on digital picture frame running DSL
 
Hi All,

I've made a digital picture frame with an old Thinkpad 600E running DSL version (um, I think) 4.3.7 (maybe??). It works pretty well with a couple minor irritations that I'm hoping to figure out with some help.

On power up, it's supposed to auto login, start up a bash window with aterm (for emergency access if SSH doesn't work), and then start a slideshow using the viewer program FEH. It does all of the above, but it starts FEH under the terminal window so that I have to manually either restart the slideshow so that it covers the window, or minimize the window with the mouse (hope that makes sense). Here is a copy of my .xinitrc file if that helps:

dsl@1[dsl]$ vim .xinitrc
1 # put X windows programs that you want started here.
2 # Be sure to add at the end of each command the &
3 # Begin DPF section
4
5 xset s off &
6 noblank &
7
8 cron &
9
10 /usr/bin/aterm -T "Bash" -e /bin/bash &
11
12 /home/dsl/frame/cron_start_frame.sh &
13
14 # End DPF section
15
16 KEYTABLE="$(getknoppixparam.lua KEYTABLE)"
17 DESKTOP="$(getoption.lua $HOME/.desktop wm)"
18 ICONS="$(getoption.lua $HOME/.desktop icons)"
19
20 umix -lf .umix 2>/dev/null
21
22 [ -f .mouse_config ] && sh .mouse_config &
23

The other small issue is that I have a cron job that runs a script to check my photo folder every few minutes, and if there are any changes (new pics added etc.) the script is supposed to run a second script that kills the currently running slideshow then restarts FEH to include the new pictures.

The cron job runs fine and it gets as far as killing the slide show, but it doesn't restart FEH, and I have to restart it by manually running the restart script via SSH.

Here's a copy of the cron and the other scripts in case it helps:

dsl@1[opt]$ vim crontab
1 #* * * * * * echo Cron timestamp `date` >> /tmp/crontest
2 #
3 #
4 # Check Photo folder every 5 min
5 /5 * * * * * /home/dsl/frame/checkdir.sh
6 #45 22 * * 1-7 * /home/dsl/frame/turn_off_screen.sh
7 #59 5 * * 1-7 * /home/dsl/frame/turn_on_screen.sh

dsl@1[frame]$ vim checkdir.sh
1 #/bin/bash
2 #monitor directory
3
4 mv /home/dsl/frame/photos.lst /home/dsl/frame/photos.last
5 ls -R /home/dsl/frame/photos > /home/dsl/frame/photos.lst
6 cmp --quiet /home/dsl/frame/photos.lst /home/dsl/frame/photos.last
7 exitcode=$?
8
9 if [ $exitcode -ne 0 ] ; then
10 echo .New Files... Reloading Frame.
11 /home/dsl/frame/cron_reload_frame.sh
12 else
13 echo .Yawn....
14 fi
15
16 exit 0


dsl@1[frame]$ vim cron_reload_frame.sh
4 # drware@thewares.net
5 #
6
7 # Change number below to the duration, in seconds
8 # for each photo to be displayed
9 DELAY="300"
10
11 # Set display so that the script will effect
12 # the screen on the frame
13 export DISPLAY=:0.0
14
15 # Stop the currently running Slide show
16 /home/dsl/frame/kill.sh feh
17
18 sleep 10s
19
20
21
22 # Start slide show
23 feh -q -r -z -F -Z -x -D $DELAY /home/dsl/frame/photos/
24
25
26 exit 0


dsl@1[frame]$ vim kill.sh
1 #!/bin/bash
2
3 if [ ! -z "$1" ]; then
4 PROCESS=$1
5
6 PIDS=ps | grep $PROCESS | awk '{print $1}' | pkill $PROCESS
7
8 fi

Any help appreciated! Like I said, I'm pretty happy with DSL and the frame, but I'd love to solve these small issues...

htrboy 05-29-2009 04:58 PM

Okay - a clue:

Now it looks like when the 'checkdir.sh' script runs and it sees a change in the photo folder, it runs cron_reload_frame.sh like it's supposed to, which then runs kill.sh - that kills feh like its supposed to but then it reports "./cron_reload_frame.sh: line 23: feh nnnnn Terminated feh -q -r -z -F -z -x -D $DELAY /home/dsl/photos/"

where nnnnn is the number of the process terminated.

Does this mean that the way I'm killing feh in the kill.sh script isn't letting feh restart?


All times are GMT -5. The time now is 10:46 AM.