2014-05-23

Install Motion(WebCam surveillance) on Fedora 20

# enable rpmfusion 
yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

# cheese for first webcam connection test
# motion and ffmpeg
# and vlc for movie clip play
yum install cheese motion ffmpeg ffmpeg-devel vlc
#
# /etc/fstab
# Created by anaconda on Mon May 19 10:36:26 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=99c4e523-5bc0-455a-8c9b-a5870a04464d /                       ext4    defaults        1 1
UUID=c1a77fdc-9cee-471f-9472-ad74c88d6b59 /boot                   ext4    defaults        1 2
UUID=58492d68-56ce-42da-a705-1f2f440b6ab3 /home                   ext4    defaults        1 2
UUID=3098b26b-2182-4d8d-ae50-92eba3b46393 swap                    swap    defaults        0 0

#motion output folder
UUID=060496D64CADD265                     /var/motion             ntfs    uid=motion,gid=video,umask=002 0 0

[root@cam01 motion]# diff -y --suppress-common-lines motion.conf.org motion.conf
rotate 0 width 320 height 240 auto_brightness off minimum_motion_frames 1 pre_capture 0 output_pictures on quality 75 ffmpeg_timelapse 0 ffmpeg_variable_bitrate 0 locate_motion_mode off locate_motion_style box ; text_left CAMERA %t snapshot_filename %v-%Y%m%d%H%M%S-snapshot picture_filename %v-%Y%m%d%H%M%S-%q movie_filename %v-%Y%m%d%H%M%S timelapse_filename %Y%m%d-timelapse stream_motion off stream_localhost on rotate 180 width 1920 height 1080 auto_brightness on minimum_motion_frames 3 pre_capture 3 output_pictures best quality 95 ffmpeg_timelapse 30 ffmpeg_variable_bitrate 2 locate_motion_mode on locate_motion_style redbox text_left CAMERA %t snapshot_filename %Y%m%d/%H%M%S-%v-snapshot picture_filename %Y%m%d/%H%M%S-%v-%q movie_filename %Y%m%d/%H%M%S-%v timelapse_filename timelapse/%Y%m%d stream_motion on stream_localhost off
[root@cam01 motion]# systemctl enable motion.service 
ln -s '/usr/lib/systemd/system/motion.service' '/etc/systemd/system/multi-user.target.wants/motion.service'
[root@cam01 motion]# systemctl start motion.service 
[root@cam01 motion]# systemctl status motion.service 
motion.service - motion detection system
   Loaded: loaded (/usr/lib/systemd/system/motion.service; enabled)
   Active: active (running) since Sat 2014-05-24 18:05:54 KST; 6s ago
     Docs: man:motion(1)
           http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome
 Main PID: 2889 (motion)
   CGroup: /system.slice/motion.service
           └─2889 /usr/bin/motion -n

...

[root@cam01 motion]# 
[root@cam01 motion]# groupmems --add tsohr --group video
[root@cam01 motion]#
[root@cam01 system]# diff -y --suppress-common-lines motion.service motion.service.old
#Environment=LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so Environment=LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so Restart=always RestartSec=30
#!/bin/bash
while true; do
 pcent=`df --sync --output=pcent /var/motion \
  | tail -n 1 | rev | cut -c 2- | rev`;

 if [[ "$pcent" < "95" ]]; then
  exit 0;
 fi;

 deltaret=`ls -d 20* | sort | head -n 1`;
 rm -rvf "$deltaret";
done;

2012-10-18

transmission mod_proxy


<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REMOTE_ADDR} ^127.0.0.1
    RewriteRule ^/transmission[/]?$   http://127.0.0.1:9003/transmission    [P,L]

    RewriteCond %{REMOTE_ADDR} ^127.0.0.1
    RewriteRule ^/transmission/(.*)$  http://127.0.0.1:9003/transmission/$1 [P,L]

    RewriteRule ^/transmission(.*)  - [F]
</IfModule>

2012-07-10

systemd service script for areca http proxy console


YOUR_INSTALL_PATH=/usr/local/sbin/areca
mkdir -p $YOUR_INSTALL_PATH
cd $YOUR_INSTALL_PATH

unzip !@#$%download_from_the_areca_website%$#@!

/lib/systemd/system/areca.service <<EOF
[Unit]
Description=Areca RAID System Administrative Console
After=network.target

[Service]
Type=simple
ExecStart=$YOUR_INSTALL_PATH/archttp64
WorkingDirectory=$YOUR_INSTALL_PATH

[Install]
WantedBy=basic.target
EOF

systemctl start areca.service

2012-07-07

dnsever script

#!/bin/sh 
DATE=`date '+%y-%m-%d %H:%M:%S'` 
RESULT=`wget -q -O - --http-user=YOUR_ID --http-passwd=YOUR_AUTH_CODE \
  'http://dyna.dnsever.com/update.php?host[YOUR_DOMAIN_NAME]' \ 
  | xmllint --xpath '//host' - ` echo $DATE $RESULT