Commit dd02a316aca0c324d7eb79c0b4bb1baa8f2e5f03

Authored by Antonio Terceiro
1 parent a8fe7f2d

Making sure Noosfero starts after a forced reboot

  * Store all temporary files in /var
  * Symlink the directories in /var inside the Noosfero directory
  * Updated sample ferret configuration
  * Updates logrotate configuration
config/ferret_server.yml.dist
1 1 production:
2 2 host: localhost
3 3 port: 9011
4   - pid_file: log/ferret.pid
  4 + pid_file: tmp/pids/ferret.production.pid
5 5 #development:
6 6 # host: localhost
7 7 # port: 9010
8   -# pid_file: log/ferret.pid
  8 +# pid_file: tmp/pids/ferret.development.pid
9 9 #test:
10 10 # host: localhost
11 11 # port: 9009
12   -# pid_file: log/ferret.pid
  12 +# pid_file: tmp/pids/ferret.test.pid
13 13 staging:
14 14 host: localhost
15 15 port: 9011
16   - pid_file: log/ferret.pid
  16 + pid_file: tmp/pids/ferret.staging.pid
... ...
etc/init.d/noosfero
... ... @@ -39,7 +39,7 @@ if [ -z $NOOSFERO_DIR ] || [ -z $NOOSFERO_USER ]; then
39 39 fi
40 40  
41 41 ######################
42   -FERRET_PID_FILE=$NOOSFERO_DIR/log/ferret.pid
  42 +FERRET_PID_FILE=$NOOSFERO_DIR/tmp/pids/ferret.production.pid
43 43  
44 44 main_script() {
45 45 cd $NOOSFERO_DIR
... ... @@ -58,6 +58,39 @@ do_start() {
58 58 exit 2
59 59 fi
60 60  
  61 + # PID directories
  62 + if [ ! -d /var/run/noosfero ]; then
  63 + mkdir /var/run/noosfero
  64 + chown $NOOSFERO_USER:root /var/run/noosfero
  65 + chmod 755 /var/run/noosfero
  66 + fi
  67 +
  68 + # Noosfero logs
  69 + if [ ! -d /var/log/noosfero ]; then
  70 + mkdir /var/log/noosfero
  71 + chown $NOOSFERO_USER:root /var/log/noosfero
  72 + chmod 750 /var/log/noosfero
  73 + fi
  74 +
  75 + # Noosfero tmp directory
  76 + if [ ! -d /var/tmp/noosfero ]; then
  77 + mkdir /var/tmp/noosfero
  78 + chown $NOOSFERO_USER:root /var/tmp/noosfero
  79 + chmod 750 /var/tmp/noosfero
  80 + fi
  81 +
  82 + # symlink the directories into Noosfero directory
  83 + if [ ! -e $NOOSFERO_DIR/tmp ]; then
  84 + ln -s /var/tmp/noosfero $NOOSFERO_DIR/tmp
  85 + fi
  86 + if [ ! -e $NOOSFERO_DIR/tmp/pids ]; then
  87 + ln -s /var/run/noosfero $NOOSFERO_DIR/tmp/pids
  88 + fi
  89 + if [ ! -e $NOOSFERO_DIR/log ]; then
  90 + ln -s /var/log/noosfero $NOOSFERO_DIR/log
  91 + fi
  92 +
  93 + # actually start the service
61 94 main_script start
62 95 }
63 96  
... ...
etc/logrotate.d/noosfero
1   -/var/lib/noosfero/current/log/*.log /home/noosfero/current/log/*.log {
  1 +/var/log/noosfero/*.log /home/noosfero/current/log/*.log {
2 2 daily
3 3 missingok
4 4 rotate 30
... ...