Pages

Tuesday, December 14, 2010

Execute script at certain time

Cronjob used for automating script in certain continues period. For execute once at certain time we can use "at" command.

user@sabily:/etc/cron.weekly$ at -m 10:00 < /home/user/ftp.sh
warning: commands will be executed using /bin/sh
job 1 at Tue Dec 14 10:00:00 2010

Automating sftp with shell script

1. Create public key on local machine

ssh-keygen -t rsa

(just choose the default options. let the passphrase blank, or else you have to enter the passphrase everytime you login. this should generate /home/localuser/.ssh/id_rsa.pub)

2. Login to remote machine 
3. Create file /home/remoteuser/.ssh/authorized_keys (if .ssh folder doesn't exists then create it, and if authorized_keys file is exists then use it)
4. Copy the contents of id_rsa.pub on local machine to authorized_keys file on remote machine
    scp .ssh/id_rea.pub remotehost:.ssh/authorized_keys
5. Run ssh-add on local machine, then you can run: "sftp remoteuser@remotehost" without password

Monday, December 13, 2010

Avoid "Page Has Expired" Warnings

This problem occurs in my office's ticketing web application (using php). When switching back to previous page using back button of the browser, it displays a warning that page has expired. To obtain it, we have to press F5 in IE. In firefox always shows cofirmation box to resend the page.

Googling for the solutions, i found two references that useful:
http://support.microsoft.com/kb/183763
http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings

I then change the php.ini configuration from:


session.cache_limiter = nocache

to:

session.cache_limiter = private

note:

lately known that this "private" option causes new problem, when clicking home the applications always prompt login form. well this is annoying.

I then set:

session.cache_limiter =

refs:
http://php.net/manual/en/function.session-cache-limiter.php
php.ini comments