viernes, 30 de abril de 2010

A script for counting

This is very easy but, just in case:
for aa in `seq 1 10`; do echo $aa; done

Generic script for managing a Unix service

Create a file with the following contents:


#!/bin/bash
export user_name="root"

export srv_name="serv"
export exec_dir_stop="/home/$user_name/bin/stop_serv.sh"
export exec_dir_start="/home/$user_name/bin/start_serv.sh"


case "$1" in
start)
echo -n "Starting $srv_name Service Daemon"

/usr/bin/sudo -u $user_name $exec_dir_start
;;
stop)
echo -n "Shutting $srv_name Service Daemon"
/usr/bin/sudo -u $user_name $exec_dir_stop
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac


Save it with a descriptive name on /etc/init.d (or /etc/rc.d) , for instance http_filter . Change the access rights to the user in charge of managing the service, and create a softlink on the run level you want the service to be started.



martes, 6 de abril de 2010

How to use ffmpeg to convert a video stream from avi to flv

This is not our usual kind of information but ... here comes an example for trancoding between avi and flv.


ffmpeg -i "e:\ejemplo_chulo.avi" -y -r 25 -b 650000 -f flv -vcodec flv -ab 128 -ar 44100 salidata.flv

For a complete list of video and audio qualities see this link