forked from macropoiesis/ALPHARUSBOT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
greenbich.service.OLD2.service
155 lines (148 loc) · 8.77 KB
/
greenbich.service.OLD2.service
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# edit and put this file into /etc/systemd/system/
[Unit]
Description=greenbich irc bot service
[Service]
ExecStart=/usr/bin/bash -c /home/user/vcs/ircbot_greenbich/bin/run.sh
[Install]
WantedBy=multi-user.target
# Fedora 34
# Creating new systemd services
# This example shows how to create a unit file for a custom service.
# Custom unit files are located in /etc/systemd/system/ and
# have a .service extension. For example, a custom foo service
# uses /etc/systemd/system/foo.service unit file.
#
# sudo ln -sv ~/vcs/greenbich-runtime/greenbich.service /etc/systemd/system/
# ls -al ~/vcs/greenbich-runtime/greenbich.service /etc/systemd/system/|grep greenbich
# -rw-rw-r--. 1 user user 570 2021-06-29 21:36:54 +08 nanoseconds:259003973 /root/vcs/greenbich-runtime/greenbich.service
# lrwxrwxrwx. 1 root root 45 2021-06-29 21:37:00 +08 nanoseconds:892976823 greenbich.service -> /root/vcs/greenbich-runtime/greenbich.service
# chown -v root.root ~/vcs/greenbich-runtime/greenbich.service
# changed owner '/root/vcs/greenbich-runtime/greenbich.service' from user:user to root:root
# export LANG=en_us.UTF-8
# rm -v /etc/systemd/system/greenbich.service
# removed '/etc/systemd/system/greenbich.service'
# cp -v ~/vcs/greenbich-runtime/greenbich.service /etc/systemd/system/greenbich.service
# '/root/vcs/greenbich-runtime/greenbich.service' -> '/etc/systemd/system/greenbich.service'
# chown -v user.user ~user/vcs/greenbich-runtime/greenbich.service
# changed ownership of '/home/user/vcs/greenbich-runtime/greenbich.service' from root:root to user:user
# systemctl daemon-reload
# systemctl start greenbich
# systemctl status greenbich
# × greenbich.service - greenbich irc bot service
# Loaded: loaded (/etc/systemd/system/greenbich.service; disabled; vendor preset: disabled)
# Active: failed (Result: exit-code) since Tue 2021-06-29 21:44:39 +08; 7s ago
# Process: 43735 ExecStart=/home/user/vcs/ircbot_greenbich/bin/run.sh (code=exited, status=203/EXEC)
# Main PID: 43735 (code=exited, status=203/EXEC)
# CPU: 1ms
#
# Jun 29 21:44:39 home1fedora34 systemd[1]: Started greenbich irc bot service.
# Jun 29 21:44:39 home1fedora34 systemd[1]: greenbich.service: Main process exited, code=exited, status=203/EXEC
# Jun 29 21:44:39 home1fedora34 systemd[1]: greenbich.service: Failed with result 'exit-code'.
#
# rm -v /etc/systemd/system/greenbich.service
#removed '/etc/systemd/system/greenbich.service'
# cp -v ~/vcs/greenbich-runtime/greenbich.service /etc/systemd/system/greenbich.service
# '/root/vcs/greenbich-runtime/greenbich.service' -> '/etc/systemd/system/greenbich.service'
# chown -v user.user ~user/vcs/greenbich-runtime/greenbich.service
# changed ownership of '/home/user/vcs/greenbich-runtime/greenbich.service' from root:root to user:user
# systemctl daemon-reload
# systemctl start greenbich
# systemctl status greenbich
#× greenbich.service - greenbich irc bot service
# Loaded: loaded (/etc/systemd/system/greenbich.service; disabled; vendor preset: disabled)
# Active: failed (Result: exit-code) since Tue 2021-06-29 21:44:39 +08; 7s ago
# Process: 43735 ExecStart=/home/user/vcs/ircbot_greenbich/bin/run.sh (code=exited, status=203/EXEC)
# Main PID: 43735 (code=exited, status=203/EXEC)
# CPU: 1ms
#
#Jun 29 21:44:39 home1fedora34 systemd[1]: Started greenbich irc bot service.
#Jun 29 21:44:39 home1fedora34 systemd[1]: greenbich.service: Main process exited, code=exited, status=203/EXEC
#Jun 29 21:44:39 home1fedora34 systemd[1]: greenbich.service: Failed with result 'exit-code'.
#cp -v ~/vcs/greenbich-runtime/greenbich.service /etc/systemd/system/greenbich.service
#'/root/vcs/greenbich-runtime/greenbich.service' -> '/etc/systemd/system/greenbich.service'
#systemctl daemon-reload
#systemctl start greenbich
#systemctl status greenbich
#× greenbich.service - greenbich irc bot service
# Loaded: loaded (/etc/systemd/system/greenbich.service; disabled; vendor preset: disabled)
# Active: failed (Result: exit-code) since Tue 2021-06-29 21:47:05 +08; 3s ago
# Process: 43978 ExecStart=/home/user/vcs/ircbot_greenbich/bin/run.sh (code=exited, status=203/EXEC)
# Main PID: 43978 (code=exited, status=203/EXEC)
# CPU: 1ms
#
#Jun 29 21:47:05 home1fedora34 systemd[1]: Started greenbich irc bot service.
#Jun 29 21:47:05 home1fedora34 systemd[43978]: greenbich.service: Failed to locate executable /home/user/vcs/ircbot_greenbich/bin/run.sh: Permission denied
#Jun 29 21:47:05 home1fedora34 systemd[43978]: greenbich.service: Failed at step EXEC spawning /home/user/vcs/ircbot_greenbich/bin/run.sh: Permission denied
#Jun 29 21:47:05 home1fedora34 systemd[1]: greenbich.service: Main process exited, code=exited, status=203/EXEC
#Jun 29 21:47:05 home1fedora34 systemd[1]: greenbich.service: Failed with result 'exit-code'.
#ls -al /home/user/vcs/ircbot_greenbich/bin/run.sh
#-rwxrwxr-x. 1 user user 69 2021-01-03 16:44:10 +08 nanoseconds:121339166 /home/user/vcs/ircbot_greenbich/bin/run.sh
#less /home/user/vcs/ircbot_greenbich/bin/run.sh
#cat /home/user/vcs/ircbot_greenbich/bin/run.sh
# #!/usr/bin/env bash
#
# cd /home/user/git/ircbot_greenbich
#
# . ./run.sh
# systemctl enable greenbich
# Created symlink /etc/systemd/system/multi-user.target.wants/greenbich.service → /etc/systemd/system/greenbich.service.
# systemctl daemon-reload
# systemctl start greenbich
# systemctl status greenbich
# × greenbich.service - greenbich irc bot service
# Loaded: loaded (/etc/systemd/system/greenbich.service; enabled; vendor preset: disabled)
# Active: failed (Result: exit-code) since Tue 2021-06-29 21:48:32 +08; 3s ago
# Process: 44103 ExecStart=/home/user/vcs/ircbot_greenbich/bin/run.sh (code=exited, status=203/EXEC)
# Main PID: 44103 (code=exited, status=203/EXEC)
# CPU: 987us
#
# Jun 29 21:48:32 home1fedora34 systemd[1]: Started greenbich irc bot service.
# Jun 29 21:48:32 home1fedora34 systemd[1]: greenbich.service: Main process exited, code=exited, status=203/EXEC
# Jun 29 21:48:32 home1fedora34 systemd[1]: greenbich.service: Failed with result 'exit-code'.
# ls -al /home/user/vcs/ircbot_greenbich/bin/run.sh
# -rwxrwxr-x. 1 user user 69 2021-01-03 16:44:10 +08 nanoseconds:121339166 /home/user/vcs/ircbot_greenbich/bin/run.sh
# cat /home/user/vcs/ircbot_greenbich/bin/run.sh|head -1
# #!/usr/bin/env bash
# which bash
# /usr/bin/bash
# cp -v ~/vcs/greenbich-runtime/greenbich.service /etc/systemd/system/greenbich.service
# '/root/vcs/greenbich-runtime/greenbich.service' -> '/etc/systemd/system/greenbich.service'
# systemctl disable greenbich
# Removed /etc/systemd/system/multi-user.target.wants/greenbich.service.
# systemctl enable greenbich
# Created symlink /etc/systemd/system/multi-user.target.wants/greenbich.service → /etc/systemd/system/greenbich.service.
# systemctl start greenbich
# systemctl status greenbich
# × greenbich.service - greenbich irc bot service
Loaded: loaded (/etc/systemd/system/greenbich.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2021-06-29 21:56:26 +08; 4s ago
Process: 44417 ExecStart=/usr/bin/bash -c /home/user/vcs/ircbot_greenbich/bin/run.sh (code=exited, status=134)
Main PID: 44417 (code=exited, status=134)
CPU: 20ms
# Jun 29 21:56:25 home1fedora34 systemd[1]: Started greenbich irc bot service.
# Jun 29 21:56:25 home1fedora34 bash[44418]: Could not find platform independent libraries <prefix>
# Jun 29 21:56:25 home1fedora34 bash[44418]: Could not find platform dependent libraries <exec_prefix>
# Jun 29 21:56:25 home1fedora34 bash[44418]: Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
# Jun 29 21:56:25 home1fedora34 bash[44418]: Fatal Python error: Py_Initialize: Unable to get the locale encoding
# Jun 29 21:56:25 home1fedora34 bash[44418]: ModuleNotFoundError: No module named 'encodings'
# Jun 29 21:56:25 home1fedora34 bash[44418]: Current thread 0x00007f011e3fc740 (most recent call first):
# Jun 29 21:56:26 home1fedora34 bash[44417]: ./run.sh: строка 3: 44418 GPF (memory dump dropped to disc) ./venv3_2/bin/python launch_all.py
# Jun 29 21:56:26 home1fedora34 systemd[1]: greenbich.service: Main process exited, code=exited, status=134/n/a
# Jun 29 21:56:26 home1fedora34 systemd[1]: greenbich.service: Failed with result 'exit-code'.
#
# ...
#
# systemctl start greenbich && systemctl status greenbich
# ● greenbich.service - greenbich irc bot service
# Loaded: loaded (/etc/systemd/system/greenbich.service; enabled; vendor preset: disabled)
# Active: active (running) since Tue 2021-06-29 22:07:04 +08; 8ms ago
# Main PID: 45136 (bash)
# Tasks: 2 (limit: 19073)
# Memory: 1.4M
# CPU: 7ms
# CGroup: /system.slice/greenbich.service
# ├─45136 bash /home/user/vcs/ircbot_greenbich/bin/run.sh
# └─45138 ./venv3_2/bin/python launch_all.py
# root@home1fedora34/root/ +2021-06-29 14:07:04 UTC nanoseconds:663087318
# Ok
#