DBNAME=${1:?”enter dbname”} DB_USERNAME=${2:?”enter db username”} CREATE_USERNAME=${3:?”enter create username”} COMMAND=${4:?”enter select or ‘select,update’ or ‘select,update,delete’ …”}
# –共通関数定義– LIST=/tmp/table.lst
psql -U ${DB_USERNAME} -d ${DBNAME} -c “select relname from pg_class where relkind=’r’ and relnamespace=(select oid from pg_namespace where nspname=’public’ order by relpages desc);” -t -A > ${LIST}
# コマンド実行 while read line do echo psql -U ${DB_USERNAME} -d ${DBNAME} -c \”grant ${COMMAND} on $line to ${CREATE_USERNAME}\;\” psql -U ${DB_USERNAME} -d ${DBNAME} -c “grant ${COMMAND} on $line to ${CREATE_USERNAME};” done < ${LIST}
[kbmj@cms tset]$ rake db:migrate(in /var/cms/test) Rails Error: Unable to access log file. Please ensure that /var/cms/test/config/../log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
chmodとか書いてあるし
あぁ権限がないのかな?
と思ってsudoをつけてもなぜかテーブルがつくれない
[kbmj@cms1 test]$ sudo rake db:migrate(in /var/cms/test)rake aborted! No such file or directory - /tmp/mysql.sock
MySQLにcacti用のデータベースを作成mysqladmin -u root -p create cacti mysql -u root -p cacti < /var/www/cacti/cacti.sql mysql -u root -p mysql GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactiuser’; flush privileges;
他PCからの閲覧を許可する場合には、以下を変更vi /etc/httpd/conf.d/cacti.conf Alias /cacti/ /var/www/cacti/ <Directory /var/www/cacti/> DirectoryIndex index.php Options -Indexes AllowOverride all order deny,allow deny from all allow from 127.0.0.1 allow from XXX.XXX.XXX.XXX 許可したいIP追加 AddType application/x-httpd-php .php php_flag magic_quotes_gpc on php_flag track_vars on </Directory>
http://(インストールしたサーバアドレス)/cacti/ にブラウザアクセス NEXT >>を選択 NEW Install >>を選択 SNMP Utility Version NET-SNMP 5.x RRDTool Utility Version RRDTool 1.2.x を選択 FINISHをクリック
ファイルの中身はこんな感じです。 # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing – SELinux security policy is enforced. # permissive – SELinux prints warnings instead of enforcing. # disabled – SELinux is fully disabled. SELINUX=enforcing # SELINUXTYPE= type of policy in use. Possible values are: # targeted – Only targeted network daemons are protected. # strict – Full SELinux protection. SELINUXTYPE=targeted
6行目をSELINUX=disabledと変更します。
変更後はこんな感じになります。 # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing – SELinux security policy is enforced. # permissive – SELinux prints warnings instead of enforcing. # disabled – SELinux is fully disabled. SELINUX=disabled #ここを変更しました # SELINUXTYPE= type of policy in use. Possible values are: # targeted – Only targeted network daemons are protected. # strict – Full SELinux protection. SELINUXTYPE=targeted
a = $*[0].split(‘ ‘).map{|i|i.to_i}+[nil] i = a[0] p a.inject([a[0].to_s]){|r, v| if i != v r << r.pop + “-#{i-1}” if 2 <= i – r.last.to_i break r unless v i = v r << i.to_s end i +=1 r }.join(‘, ‘)+’.’