TS3Tools / TS3UpdateScript

Automate all update processes for your TeamSpeak 3 server instances
GNU General Public License v3.0
189 stars 22 forks source link

Update failed - cp: cannot create regular file ‘./ts3server’: Text file busy #106

Closed tomiie6 closed 4 years ago

tomiie6 commented 4 years ago

Please answer: ([y]es/[n]o) y Temporary server passwords were not backuped, because you've disabled it or whether telnet nor expect is installed. TeamSpeak 3 server instance stopped for update process. Backup created successful. cp: cannot create regular file ‘./ts3server’: Text file busy Could not update TeamSpeak 3 server instance. Do you have enough space on '/home/teamspeak'? /home/teamspeak/TS3UpdateScript/TS3UpdateScript: line 2141: expect: command not found Due of the failed update, the TS3UpdateScript has created a debug report in /home/teamspeak/20200417-1004-ts3us-debug-report.md Update failed. Rollback to the version '3.11.0'. Could not start TeamSpeak 3 server instance. The backup for this instance wasn't deleted. Backup can be found here: /tmp/TS3Tools/TS3UpdateScript/5bc202c88e6448e17d805cc22d2c5c1c/

Cleaning up...

cp: cannot create regular file ‘./ts3server’: Text file busy Could not start TeamSpeak 3 server instance. Did the script possibly fail to stop the service? I thought that first because it logged it couldn't restart it after the (errored) update process, but it was running actually. Then I retried the update and here's what happened: the server stopped as intended but came back online by the time the 'Backup created successful.' line appeared in the log, so no wonder the 'ts3server' file couldn't be overwritten during the update. What can be wrong? It worked fine before.

Sebbo94BY commented 4 years ago

First of all, you should install expect for a more stable functionality of the script.

Do you have any script / service, which ensures, that your TS3 server is running all the time? A systemd script for example?

The TS3UpdateScript automatically creates the file .ts3updatescript.lock in the root directory of your instance. This indicates, that the script is currently updating your instance. You can use this file for conditions to avoid autom. restarts of the instance.

Here is an example for a systemd script:

$ cat /etc/systemd/system/ts3server.service 
[Unit]
Description=TeamSpeak 3 Server
After=network.target mysqld.service
ConditionPathExists=!/home/teamspeak/.ts3updatescript.lock

[Install]
WantedBy=multi-user.target
Alias=ts3server.service

[Service]
User=teamspeak
Group=teamspeak
WorkingDirectory=/home/teamspeak/
ExecStart=/home/teamspeak/ts3server_startscript.sh start
ExecStop=/home/teamspeak/ts3server_startscript.sh stop
ExecReload=/home/teamspeak/ts3server_startscript.sh restart
PIDFile=/home/teamspeak/ts3server.pid
Restart=always
Type=forking
tomiie6 commented 4 years ago

Thank you @Sebi94nbg , adding the 'ConditionPathExists' property solved the issue.