• Ubuntu Perl locale problem

    edit the file
    /etc/environment

    add one line with your LANG, like this

    LC_ALL="en_US.UTF-8"

    save and reboot


  • Create .deb file

    Create a directory to make your package in. The name should be the same as the package name.
    mkdir helloworld_1.0-1

    Pretend that the packaging directory is actually the root of the file system. Put the files of your program where they would be installed to on a system.
    mkdir helloworld_1.0-1/usr
    mkdir helloworld_1.0-1/usr/local
    mkdir helloworld_1.0-1/usr/local/bin
    cp "~/Projects/Hello World/helloworld" helloworld_1.0-1/usr/local/bin

    Now create a special metadata file with which the package manager will install your program…
    mkdir helloworld_1.0-1/DEBIAN
    gedit helloworld_1.0-1/DEBIAN/control

    Put something like this in that file…
    Package: helloworld
    Version: 1.0-1
    Section: base
    Priority: optional
    Architecture: i386
    Depends: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
    Maintainer: Your Name <you@email.com>
    Description: Hello World
    When you need some sunshine, just run this
    small program!

    (the space before each line in the description is important)

    Now you just need to make the package:
    dpkg-deb --build helloworld_1.0-1

    Script files in /DEBIAN/ folder
    Postinst means: "AFTER the files have been Copied To the iDevice, THEN Run this Script."
    Preinst means: "BEFORE the files Get Copied To the iDevice, Run this Script, THEN Copy the files To the iDevice."
    Postrm means: "AFTER the files have been Removed From the iDevice, THEN Run this Script."
    Prerm means: "BEFORE the files Get Removed From your iDevice, Run this Script, THEN Remove the files From the iDevice."

    Sample postinst:
    #!/bin/bash
    cd /var/mobile/Applications/*/Game.app
    mkdir Backups
    cp -a ./Original_File.ext ./Backups/Original_File.bak
    killall Game
    mv -f /var/mobile/Documents/GameMod/Game/* ./
    exit 0


  • process

    $ sudo update-rc.d myserver defaults

    To do this, you must create this file and save it in /etc/init.d/.

    #!/bin/sh

    DAEMON="/path/to/myserver.py"
    DAEMONUSER="myuser"
    DEAMON_NAME="myserver.py"

    PATH="/sbin:/bin:/usr/sbin:/usr/bin"

    test -x $DAEMON || exit 0

    . /lib/lsb/init-functions

    d_start () {
    log_daemon_msg "Starting system $DEAMON_NAME Daemon"
    start-stop-daemon --background --name $DEAMON_NAME --start --user $DAEMONUSER --exec $DAEMON
    log_end_msg $?
    }

    d_stop () {
    log_daemon_msg "Stopping system $DEAMON_NAME Daemon"
    start-stop-daemon --name $DEAMON_NAME --stop --retry 5 --name $DEAMON_NAME
    log_end_msg $?
    }

    case "$1" in

    start|stop)
    d_${1}
    ;;

    restart|reload|force-reload)
    d_stop
    d_start
    ;;

    force-stop)
    d_stop
    killall -q $DEAMON_NAME || true
    sleep 2
    killall -q -9 $DEAMON_NAME || true
    ;;

    status)
    status_of_proc "$DEAMON_NAME" "$DAEMON" "system-wide $DEAMON_NAME" && exit 0 || exit $?
    ;;
    *)
    echo "Usage: /etc/init.d/$DEAMON_NAME {start|stop|force-stop|restart|reload|force-reload|status}"
    exit 1
    ;;
    esac
    exit 0

    $ sudo chmod 755 /etc/init.d/myserver
    $ sudo chmod 755 /path/to/mserver.py

    http://stackoverflow.com/questions/13718821/run-python-script-as-daemon-at-boot-time-ubuntu


  • sshfs mount

    sshfs root@10.233.10.212:/ /mnt/ssh/