• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Linux Users <Startup, Shutdown> script

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,780
Solutions
31
Reaction score
2,299
Location
Sweden?
Hello,

Well i will soon open my server. So i will need a script for linux debian. It should include:

  • When your dedicate server start, then it should execute the script "startup"
    • Allow core dumps
    • Rum server in nohup or screen
    • Set timer for next script
  • When the server makes a global save to shutdown at 10:00 CEST/CET. execute the script "shutdown"
    • Make a backup of database with format date
    • Execute apt-get update && apt-get upgrade
    • Add startup script as task next time it reboot
    • Reboot when it finished all those tasks
I have almost the first script, but dont know how to run next one at certain time:

Code:
# Allow core dumps
ulimit -c unlimited

# Set working directory
cd home/server/

# Run server
nohup ./tfs

# Schedule next script
# ?? No idea how

Thanks.
 
well, I always heard about crontab and it's cron jobs.
With that you can schedule commands to be run at a certain time.
I see, i'll take a look into it. See if i can do something. Thanks anyway.
 
Hello Printer,

I'm a sys admin (that's the main job I got). Ubuntu & Debian running as main servers @ the enterprise I work for. We got loads of services running (Radius, DNS, DHCP, SVN, Gitlab and lots more). I programmed some dumps for the backup on the magnetic tape...

Debian Community offers pretty good support, you'll need bash scripts for these actions.


Thats a bash script for running your stuff as soon as system starts (startup):
Code:
#! /bin/sh
# /etc/init.d/printersots?
#

# stuff that always run
touch /var/lock/printersots?

# scripts to run when system asks
case "$1" in
  start)
    echo "Starting script printersots? "
    ;;
  stop)
    echo "Stopping script printersots?"
    ;;
  *)
    echo "Usage: /etc/init.d/printersots? {start|stop}"
    exit 1
    ;;
esac

exit 0

For MySQL Dumps make sure to install the mysqldump tool.

For running stuff at a certain time, try "at 10:00".

I'm up for helping if you need, just let me know :)

Kindest Regards,
Okke.
 
Back
Top