controlling windows

Place to discuss Fedora and/or Red Hat
byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Wed Jun 17, 2009 3:37 pm

not to sound too much like a n00b, but one question, everytime rsync runs, it updates the timestamp when I do a 'ls -al'
I thought rsync preserved permissions, times, etc by default...
my rsync command in cron is:
rsync -avz -e "ssh -i /home/username/rsa_key" user@10.10.10.10:/home/user/source/ /home/user/mojo/
then it does
cp -Rf /home/user/mojo /var/www/html/

so do I modify how rsync syncs the files?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5715
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Jun 17, 2009 3:50 pm

The rsync should not be updating your timestamps but that "cp" command you are using will without telling it to preserve the timestamps (e.g. "cp -a").

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Thu Jun 18, 2009 7:26 am

my perl is not good enough to translate your logic into a working example. If you have time, could you help? :oops:

User avatar
Void Main
Site Admin
Site Admin
Posts: 5715
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jun 18, 2009 8:02 am

Are the file names you are checking static? If so can you give me a list of which names you want to check for modifications?

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Thu Jun 18, 2009 8:36 am

they would be static, cause I think regardless if we add swf files, the XML file is the control file and that would change, so 'playlist.xml' is the name of the file.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5715
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jun 18, 2009 11:28 am

Here you go:

file_watch.pl

Code: Select all

#!/usr/bin/perl -w

use strict;

# Which file do you want to watch?
my $filename = "/tmp/playlist.xml";

# Get last modified time (UNIX timestamp)
my $oldxmldate = (stat($filename))[9];
my $xmldate = $oldxmldate;

# Debug print
#print "filename: $filename, xmldate: $xmldate\n";

# Loop forever
while (1) {

    if ($xmldate > $oldxmldate) {

       # Debug print
       #print "$filename updated, refreshing browser.\n";

       # Refresh browser
       system("firefox -remote \"openURL(http://localhost/Player.html)\"");

       # File was modified, update oldxmldate variable with current
       $oldxmldate = $xmldate;

    }

    # Sleep 15 seconds so you don't peg your disk/cpu
    sleep 15;

    # Get last modified time (UNIX timestamp)
    $xmldate = (stat($filename))[9];

}
All you should have to do is set the "filename" variable to the full path of the xml file you want to watch and run the program in your user's session startup.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Thu Jun 18, 2009 3:07 pm

AWESOME!! Works like a champ. Now, thanks to you, I am one step closer to replacing our windoze players with something that just works all the time, instead of nightly reboots. Need to find a way to get News, Weather, Sports, and Stocks (dynamically based on the client) and I will be golden.

On a note looking ahead, is there an easy way to configure a system exactly as you want it, then package it up into an installer CD?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5715
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Jun 18, 2009 6:29 pm

You should be able to do a custom install using "kickstart". We do kickstart installs at work from a Red Hat Satellite server. Have you considered creating a custom live CD (or thumb drive boot) and just booting that?

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Fri Jun 19, 2009 7:14 am

Yeah, I read up on that last night, and it doesnt seem that difficult. I think I am getting way ahead of myself, but as far as the player, which is the most difficult part, its done. I still have to build a content server, a database and a website to have the clients modify their content. Still a long way, but I have the approval from the higherups to proceed. More to come. Thanks for all your help.

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jun 23, 2009 8:53 am

another tidbit that just came up, how can I get rid of the Default Keyring that keeps popping up when I access my wireless network? I have my digital signage player on a wireless but it wants the WPA key everytime and after I enter that, the nm-applet wants a password for the default keyring...
should I close Network Manager and use wpa_supplicant instead? I would rather use NM but with out the keyring thing popping up...

User avatar
Void Main
Site Admin
Site Admin
Posts: 5715
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jun 23, 2009 1:37 pm

I don't believe I've run into that problem. I am running NetworkManager on both my kids laptops and I don't recall being prompted (I don't remember what release I'm running, I think F10 or F9 on one and F10 on the other). On my laptop I just recently upgraded to F11 but I do not use NetworkManager on it. I disable the NetworkManager and wpa_supplicant services and use the regular old network configs (ifcfg-wlan0) in /etc/sysconfig/network-scripts. In addition to this I have it start wpa in the ifup-wireless script. At the end of the script I have this line:

Code: Select all

/usr/sbin/wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext -B
If you down and up the interface you'll have to kill off the wpa_supplicant after downing and before upping (or you could add a kill in your down script).

My ifcfg-wlan0 looks like this:

Code: Select all

DEVICE=wlan0
IPV6INIT=no
TYPE=Wireless
ONBOOT=yes
DHCP_HOSTNAME=mylinuxhost
BOOTPROTO=dhcp
IWPRIV="mode 0"
ESSID=MyESSID
CHANNEL=5
USERCTL=yes
PEERDNS=yes
MODE=Managed
RATE=auto
NM_CONTROLLED=no
IPV6INIT=no
IPV6_AUTOCONF=no
And of course your /etc/wpa_supplicant.conf has to be configured properly.

I have searched google and found other people complaining of a similar problem you refer to but didn't see an answer on a quick search. What OS are you running?

byrdman
administrator
administrator
Posts: 225
Joined: Thu May 08, 2003 1:59 pm
Location: In the cloud

Post by byrdman » Tue Jun 23, 2009 3:24 pm

I have my player with F10. I have thought about upgrading to 11 but I think I will wait for a little while. The big boss was just sold on the idea of the complete linux system, that I have been trying to convince them on, so now it is full balls out development!! Yeah!! :D

User avatar
Void Main
Site Admin
Site Admin
Posts: 5715
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue Jun 23, 2009 5:32 pm

I have been doing it like I mentioned in that last post for several releases (since before they ever included a NetworkManager).

Post Reply