$BASH_ENV | absolute path of startup file |
$CDPATH | directories searched by cd |
$FCEDIT | absolute path of history editor |
$HISTCMD | the history number of the current command |
$HISFILE | absolute path of history file |
$HISTSIZE | number of remembered commands |
$HOME | login directory |
$IFS | token delimiters |
$LINENO | current line number in shell script |
$LINES | terminal height |
absolute path of mailbox | |
$MAILCHECK | number of seconds to check mail |
$OLDPWD | absolute path of previous directory |
$OPTARG | option set by getopt |
$OPTIND | option's ordinal position set by getopt |
$OSTYPE | the OS on which bash is executing |
$PATH | command search path |
$PPID | process ID of parent |
$PS1 | primary prompt |
$PS2 | secondary prompt |
$PWD | absolute path of current directory |
$RANDOM | random integer |
$REPLY | default variable for read |
$SECONDS | number of seconds since shell started |
$SHELL | absolute pathname of preferred shell |
$TMOUT | seconds to log out after lack of use |
$UID | user ID of the current user |
$$ | process ID of current shell |
$? | exit status of most recent statement |
$# | 參數的數目 |
$* | 代表所有參數 |
$! | PID of the most recently started backgroup job |
2014年12月31日 星期三
[FW]linux - bash script environment variables
Reference:https://sites.google.com/site/tiger2000/home
2014年12月30日 星期二
[FW] Linux - shell script - detect multiple running instances of it self
Reference: http://giantdorks.org/alain/make-a-bash-script-quit-if-it-detects-multiple-running-instances-of-itself/
#!/bin/bash if [ "$(pgrep -x $(basename $0))" != "$$" ]; then echo "Error: another instance of $(basename $0) is already running" exit 1 fi
Redmie - Useful plugin
- redmine dashboard
- Info: http://www.redmine.org/plugins/redmine-dashboard
- Steps
- cd /opt/bitnami/apps/redmine/htdocs/plugins
- git clone https://github.com/jgraichen/redmine_dashboard.git
- bundle install
- redmine default assign
- Info: https://github.com/giddie/redmine_default_assign
- Steps
- cd /opt/bitnami/apps/redmine/htdocs/plugins
- git clone https://github.com/giddie/redmine_default_assign.git
- rake db:migrate_plugins RAILS_ENV=production
2014年5月28日 星期三
VirtualBox - Waiting for network configuration issue (Missing eth0)
- if MAC address changed
- Remove /etc/udev/rules.d/70-persistent-net.rules file to make sure the new adapter to be eth0;
- Or update the /etc/network/interfaces for proper configuration for the new adapter (it maybe eth1, eth2 or ...)
2014年5月20日 星期二
[FW] Using gzip and gunzip with mysql to import/export backups
Exporting:
mysqldump -u user -p database | gzip > database.sql.gz
gunzip < database.sql.gz | mysql -u user -p database
refer: http://failshell.io/mysql/using-gzip-and-gunzip-with-mysql-to-importexport-backups/
2014年5月19日 星期一
Mount cifs on Ubuntu Server (Microsoft Windows Shares)
1. sudo apt-get install cifs-utils
2. Temporary
2.1. mount -t cifs //XXX/XXX -o username=XXX,password=xxx /media/mnt
3. Permanent (for user MyAccount which uid is 1000)
3.1. Add a file .smbcredentials under /home/MyAccount with following informaiton
username=XXX
password=xxx
3.2 Add following into /etc/fstab
//XXX/XXX /media/mnt cif uid=1000,credentials=/home/MyAccount/.smbcredentials 0 0
3.3. mount -a
refer: https://wiki.ubuntu.com/MountWindowsSharesPermanently
2. Temporary
2.1. mount -t cifs //XXX/XXX -o username=XXX,password=xxx /media/mnt
3. Permanent (for user MyAccount which uid is 1000)
3.1. Add a file .smbcredentials under /home/MyAccount with following informaiton
username=XXX
password=xxx
3.2 Add following into /etc/fstab
//XXX/XXX /media/mnt cif uid=1000,credentials=/home/MyAccount/.smbcredentials 0 0
3.3. mount -a
refer: https://wiki.ubuntu.com/MountWindowsSharesPermanently
Update timezone on Ubuntu Server
1. Check Timezone
$ cat /etc/timezone
Etc/UTC
2. sudo dpkg-reconfigure tzdata
select Asia
select Taipei
Refer: http://www.christopherirish.com/2012/03/21/how-to-set-the-timezone-on-ubuntu-server/
訂閱:
文章 (Atom)