Added service files

This commit is contained in:
SebastianObi 2023-08-10 20:55:36 +02:00
parent 53dc185d70
commit a478a39a05
14 changed files with 177 additions and 6 deletions

View File

@ -21,7 +21,7 @@ COMMENT_INIT="Initial commit"
_prompt() {
echo -e ""
echo -e "Select an option:"
options=("Commit/Push" "Clear History" "Init" "Init (Pull only)" "Exit")
options=("Commit/Push" "Clear History" "Init" "Init (Pull only)" "Init (Push only)" "Exit")
select opt in "${options[@]}"; do
case $opt in
"Commit/Push"*)
@ -33,6 +33,9 @@ _prompt() {
"Init (Pull only)"*)
_init_pull
break;;
"Init (Push only)"*)
_init_push
break;;
"Init"*)
_init
break;;
@ -152,6 +155,28 @@ _init_pull() {
}
_init_push() {
echo -e ""
echo -e "Init (Push only)"
read VAR
if [ -z "${VAR}" ]; then
VAR="${COMMENT_INIT}"
fi
rm -rf .git
git init
_define_files
git branch -M "${BRANCH}"
git remote add origin "${ORIGIN}"
git push -f -u origin "${BRANCH}"
}
##############################################################################################################
# Setup/Start

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_bridge_matrix
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_bridge_matrix/lxmf_bridge_matrix.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_bridge_meshtastic
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_bridge_meshtastic/lxmf_bridge_meshtastic.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_bridge_mqtt
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_bridge_mqtt/lxmf_bridge_mqtt.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_bridge_telegram
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_bridge_telegram/lxmf_bridge_telegram.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_chatbot
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_chatbot/lxmf_chatbot.py
[Install]
WantedBy=multi-user.target

12
lxmf_cmd/lxmf_cmd.service Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_cmd
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_cmd/lxmf_cmd.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_distribution_group
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_distribution_group/lxmf_distribution_group.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_distribution_group_minimal
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_distribution_group_minimal/lxmf_distribution_group_minimal.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_echo
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_echo/lxmf_echo.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_ping
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_ping/lxmf_ping.py
[Install]
WantedBy=multi-user.target

View File

@ -739,7 +739,7 @@ def jobs_in():
result = dbc.fetchall()
if len(result) == 0:
user_id = str(uuid.uuid4())
dbc.execute("INSERT INTO members (member_user_id, member_email, member_password, member_dob, member_sex, member_introduction, member_country, member_state, member_city, member_occupation, member_skills, member_tasks, member_wallet_address, member_accept_rules, member_language, member_locale, member_ts_add, member_status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '0')", (
dbc.execute("INSERT INTO members (member_user_id, member_email, member_password, member_dob, member_sex, member_introduction, member_country, member_state, member_city, member_occupation, member_skills, member_tasks, member_wallet_address, member_accept_rules, member_language, member_locale, member_ts_add, member_ts_edit, member_auth_state, member_auth_role) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '0', '0')", (
user_id,
data["email"],
data["password"],
@ -756,6 +756,7 @@ def jobs_in():
data["accept_rules"],
data["language"],
data["language"],
datetime.now(timezone.utc),
datetime.now(timezone.utc)
)
)
@ -793,7 +794,7 @@ def jobs_in():
result = dbc.fetchall()
if len(result) == 0:
user_id = str(uuid.uuid4())
dbc.execute("INSERT INTO members (member_user_id, member_email, member_password, member_dob, member_sex, member_introduction, member_country, member_state, member_city, member_occupation, member_skills, member_tasks, member_wallet_address, member_accept_rules, member_language, member_locale, member_ts_add, member_status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '0')", (
dbc.execute("INSERT INTO members (member_user_id, member_email, member_password, member_dob, member_sex, member_introduction, member_country, member_state, member_city, member_occupation, member_skills, member_tasks, member_wallet_address, member_accept_rules, member_language, member_locale, member_ts_add, member_ts_edit, member_auth_state, member_auth_role) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '0', '0')", (
user_id,
data["email"],
data["password"],
@ -810,6 +811,7 @@ def jobs_in():
data["accept_rules"],
data["language"],
data["language"],
datetime.now(timezone.utc),
datetime.now(timezone.utc)
)
)
@ -871,7 +873,7 @@ def jobs_in():
CACHE_DEL.append(key)
if data["type"] == "account_prove" and CONFIG["features"].getboolean("account_prove"):
dbc.execute("SELECT device_user_id FROM devices LEFT JOIN members ON members.member_user_id = devices.device_user_id WHERE devices.device_rns_id = %s and members.member_status = '1'", (data["hash_destination"], ))
dbc.execute("SELECT device_user_id FROM devices LEFT JOIN members ON members.member_user_id = devices.device_user_id WHERE devices.device_rns_id = %s and members.member_auth_state = '1'", (data["hash_destination"], ))
result = dbc.fetchall()
if len(result) == 1:
source_user_id = result[0][0]
@ -880,13 +882,13 @@ def jobs_in():
if len(result) == 1:
destination_user_id = result[0][0]
dbc.execute("INSERT INTO proves (prove_source_user_id, prove_destination_user_id) VALUES (%s, %s)", (source_user_id, destination_user_id))
dbc.execute("SELECT member_status FROM members WHERE member_user_id = %s AND member_status = '0'", (destination_user_id, ))
dbc.execute("SELECT member_auth_state FROM members WHERE member_user_id = %s AND member_auth_state = '0'", (destination_user_id, ))
result = dbc.fetchall()
if len(result) == 1:
dbc.execute("SELECT * FROM proves WHERE prove_destination_user_id = %s", (destination_user_id,))
result = dbc.fetchall()
if len(result) >= 2:
dbc.execute("UPDATE members SET member_status = '1' WHERE member_user_id = %s AND member_status = '0'", (destination_user_id,))
dbc.execute("UPDATE members SET member_auth_state = '1' WHERE member_user_id = %s AND member_auth_state = '0'", (destination_user_id,))
if CONFIG["features"].getboolean("account_prove_auth"):
fields = {}
if CONFIG["lxmf"]["destination_type_conv"] != "":

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_provisioning
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_provisioning/lxmf_provisioning.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=lxmf_terminal
After=multi-user.target
[Service]
ExecStartPre=/bin/sleep 10
Type=simple
Restart=always
RestartSec=3
User=root
ExecStart=/root/LXMF-Tools/lxmf_terminal/lxmf_terminal.py
[Install]
WantedBy=multi-user.target