• Home
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
  • CMS
    • Magento
    • Yahoo! Store

Add Supervisor to Centos/cPanel Server w/chkservd

Saturday, 11 February 2017 21:05
Tim Ramsey
0 Comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#install Supervisor
yum install python-setuptools
easy_install supervisor
 
#check install
supervisord --version
 
#create config File and directory to hold them
mkdir /etc/supervisor/conf.d
echo_supervisord_conf > /etc/supervisor/supervisord.conf
 
#create script to give service controls
nano /etc/init.d/supervisord
 
#paste into file
#!/bin/bash
. /etc/init.d/functions
DAEMON=/usr/bin/supervisord
PIDFILE=/var/run/supervisord.pid
[ -x "$DAEMON" ] || exit 0
start() {
        echo -n "Starting supervisord: "
        if [ -f $PIDFILE ]; then
                PID=`cat $PIDFILE`
                echo supervisord already running: $PID
                exit 2;
        else
                daemon  $DAEMON --pidfile=$PIDFILE -c /etc/supervisor/supervisord.conf
                RETVAL=$?
                echo
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
                return $RETVAL
        fi
}
stop() {
        echo -n "Shutting down supervisord: "
        echo
        killproc -p $PIDFILE supervisord
        echo
        rm -f /var/lock/subsys/supervisord
        return 0
}
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status supervisord
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage:  {start|stop|status|restart}"
        exit 1
        ;;
esac
exit $?
 
#save file then make sure it is executable
chmod 755 /etc/init.d/supervisord
 
#create supervisor config file for laravel
nano /etc/supervisor/conf.d/laravel-worker.conf
 
#paste contents making changes for your setup
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/forge/app.com/artisan queue:work sqs --sleep=3 --tries=3
autostart=true
autorestart=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker.log
 
#update main supervisor config to include all configs inside conf.d dir
nano /etc/supervisor/supervisord.conf
 
#uncomment files area
[include]
files = conf.d/*.conf
 
#add supervisor to chkservd
nano /etc/chkserv.d/supervisord
service[supervisord]=x,x,x,/etc/init.d/supervisord restart,supervisord,root|supervisord
#Add this line to /etc/chkserv.d/chkservd.conf
supervisord:1
#If you need to /scripts/restartsrv_tailwatchd as chkservd is now a part of tailwatch
 
#useful commands
service supervisord start
service supervisord stop
service supervisord status
service supervisord restart
 
#reread config
supervisorctl reread
 
#update reread
supervisorctl update

Command Line Database and user creation

Monday, 11 July 2016 12:58
Tim Ramsey
0 Comments
 
1
2
3
4
CREATE DATABASE databasename;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON databasename.* TO 'user'@'localhost';
FLUSH PRIVILEGES;

nginx subdomain for WordPress Install

Monday, 11 July 2016 12:45
Tim Ramsey
0 Comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#Add A Record to Point to Server IP
cd /etc/nginx/sites-available
cat default.conf > subdomain.conf
nano subdomain.conf
 
#Wordpress subdomain.conf Contents
 
server {
    listen 80;
 
    root /var/www/html/blog;
    index index.php index.html index.htm;
 
    ###################################################
 
    server_name blog.domain.com;
 
    # WordPress single site rules.
    # Designed to be included in any server {} block.
    
    # This order might seem weird - this is attempted to match last if rules below fail.
    # http://wiki.nginx.org/HttpCoreModule
    location / {
            try_files $uri $uri/ /index.php?$args;
    }
    
    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    
    # Directives to send expires headers and turn off 404 error logging.
    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
           access_log off; log_not_found off; expires max;
    }
    
    # Uncomment one of the lines below for the appropriate caching plugin (if used).
    #include global/wordpress-wp-super-cache.conf;
    #include global/wordpress-w3-total-cache.conf;
    
    # Pass all .php files onto a php-fpm/php-fcgi server.
    location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            if (!-f $document_root$fastcgi_script_name) {
                    return 404;
            }
            # This is a robust solution for path info security issue and works with "cgi.fix_pathinfo = 1" in /etc/php.ini (default)
    
            include fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #       fastcgi_intercept_errors on;
            fastcgi_pass 127.0.0.1:9000;
    }
 
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    
    location ~ /\. {
        deny all;
    }
    
    location ~* /(?:uploads|files)/.*\.php$ {
        deny all;
    }
}
 
#test nginx
nginx -t
 
#restart nginx
service nginx restart

Add Beanstalkd to Cpanel Centos Linux

Sunday, 08 May 2016 03:54
Tim Ramsey
0 Comments
1
2
3
4
5
#You need to have the EPEL Repo Installed = yum -y install epel-release ^ yum repolist
yum install beanstalkd
chkconfig beanstalkd on
service beanstalkd start
service beanstalkd status
I am using cPanel and added this to chkservd so to make sure that it always stays running
1
2
3
4
5
6
7
nano /etc/chkserv.d/beanstalkd
service[beanstalkd]=x,x,x,/etc/init.d/beanstalkd restart,beanstalkd,root|beanstalkd
 
#Add this line to /etc/chkserv.d/chkservd.conf
beanstalkd:1
 
#If you need to /scripts/restartsrv_tailwatchd as chkservd is now a part of tailwatch

Page 11 of 15

  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • Next

Categories

  • CMS
    • Magento
    • Shopify
    • Yahoo! Store
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
    • SVN
  • VOIP

Recent Posts

  • How to write to Google Sheet with API in PHP
  • How to Migrate FreePBX server to a new server
  • Unifi Controller Java CPU 100%
  • Update Unifi Controller on Linux
  • Code Signing Desktop App