Skip to content

Commit

Permalink
Restart Telegram after setting token.
Browse files Browse the repository at this point in the history
Signed-off-by: Bofu Chen (bafu) <[email protected]>
  • Loading branch information
bafu committed Jan 15, 2020
1 parent e56468a commit 12ad885
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions includes/telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function DisplayTelegramConfig($username, $password)
$content = '{"token": "'.$_POST['telegramtoken'].'"}';
fwrite($auth_file, $content);
fclose($auth_file);
exec('sudo /etc/raspap/aikea/restarttelegram.sh');
$status->addMessage('Telegram token updated');
} else {
$status->addMessage('Failed to update Telegram token', 'danger');
Expand Down
4 changes: 4 additions & 0 deletions installers/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ function create_aikea_scripts() {
# Move service control shell scripts
sudo cp "$webroot_dir/installers/"restartpipeline.sh "$raspap_dir/aikea" || install_error "Unable to move service control scripts"
sudo cp "$webroot_dir/installers/"switchconfig.sh "$raspap_dir/aikea" || install_error "Unable to move service control scripts"
sudo cp "$webroot_dir/installers/"restarttelegram.sh "$raspap_dir/aikea" || install_error "Unable to move service control scripts"
# Make configport.sh writable by www-data group
sudo chown -c root:"$raspap_user" "$raspap_dir/aikea/"restartpipeline.sh || install_error "Unable change owner and/or group"
sudo chown -c root:"$raspap_user" "$raspap_dir/aikea/"switchconfig.sh || install_error "Unable change owner and/or group"
sudo chown -c root:"$raspap_user" "$raspap_dir/aikea/"restarttelegram.sh || install_error "Unable change owner and/or group"
sudo chmod 750 "$raspap_dir/aikea/"restartpipeline.sh || install_error "Unable to change file permissions"
sudo chmod 750 "$raspap_dir/aikea/"switchconfig.sh || install_error "Unable to change file permissions"
sudo chmod 750 "$raspap_dir/aikea/"restarttelegram.sh || install_error "Unable to change file permissions"
}

# Prompt to install openvpn
Expand Down Expand Up @@ -341,6 +344,7 @@ function patch_system_files() {
"/etc/raspap/openvpn/configauth.sh"
"/etc/raspap/aikea/restartpipeline.sh"
"/etc/raspap/aikea/switchconfig.sh"
"/etc/raspap/aikea/restarttelegram.sh"
)

# Check if sudoers needs patching
Expand Down
2 changes: 2 additions & 0 deletions installers/restarttelegram.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
supervisorctl restart telegram

0 comments on commit 12ad885

Please sign in to comment.