This commit is contained in:
Aliberk Sandıkçı 2024-01-07 15:46:44 +03:00
parent 7980bab312
commit 977776ac81
Signed by: asandikci
GPG Key ID: 25C67A03B5666BC1
3 changed files with 15 additions and 8 deletions

View File

@ -1,2 +1,3 @@
<?php
$DATAACCESS_TOKEN = '__ACCESS_TOKEN__';
$APP_NAME = '__NAME__';

View File

@ -26,7 +26,7 @@ source /usr/share/yunohost/helpers
# ...
#
# $app is the app id (i.e. 'example' for first install,
# $app is the app id (i.e. 'example' for first install,
# or 'example__2', '__3', ... for multi-instance installs)
#
@ -44,7 +44,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir"
# $install_dir will automatically be initialized with some decent
# $install_dir will automatically be initialized with some decent
# permission by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$install_dir"
@ -155,10 +155,16 @@ chown $app:$app "$install_dir/config.php"
chmod -R 700 "$install_dir/src/"
chown -R $app:$app "$install_dir/src/"
php -r "require '/var/www/$app/src/server.php'; updateRemoteData(); ";
php -r "require '/var/www/$app/src/server.php'; updateRemoteData(); "
chown $app:$app "$install_dir/data.toml"
chmod 700 "$install_dir/data.toml"
crontab -l | { cat; echo "*/10 * * * * php -r \"require '/var/www/$app/src/server.php'; updateRemoteData(); \""; } | crontab -
echo "*/10 * * * * php -r \"require '/var/www/$app/src/server.php'; updateRemoteData(); \"" >>"/etc/cron.d/$app"
php -r "require '/var/www/$app/src/server.php'; chooseTodayPerson(); "
chown $app:$app "$install_dir/src/todays.php"
chmod 700 "$install_dir/src/todays.php"
echo "0 0 * * * php -r \"require '/var/www/$app/src/server.php'; chooseTodayPerson(); \"" >>"/etc/cron.d/$app"
### For more complex cases where you want to replace stuff using regexes,
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
@ -185,7 +191,7 @@ ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# ynh_script_progression --message="Starting a systemd service..." --weight=1
### `ynh_systemd_action` is used to start a systemd service for an app.
### Only needed if you have configure a systemd service
@ -196,7 +202,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
# ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT

View File

@ -133,9 +133,9 @@ chown -R $app:$app "$install_dir/src/"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
# ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT