Skip to content

Instantly share code, notes, and snippets.

@shannah
Created December 21, 2021 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shannah/c7b75557e98e8671d67ec3751b0b19ea to your computer and use it in GitHub Desktop.
Save shannah/c7b75557e98e8671d67ec3751b0b19ea to your computer and use it in GitHub Desktop.
Shellmarks server management script for Tuxpin
#!/bin/bash
echo "Running with ${serverStatus}"
PORT="9090"
TUXPIN_PATH=/path/to/tuxpin
URL="http://localhost:$PORT"
if [ ! -z "$startServer" ]; then
ACTIVE=$(lsof -P -i TCP -s TCP:LISTEN | grep "$PORT")
if [ ! -z "$ACTIVE" ]; then
if [ ! -z "$openOnStart" ]; then
open "$URL"
fi
exit 0
fi
cd "$TUXPIN_PATH"
xataface start
if [ ! -z "$openOnStart" ]; then
open $URL
fi
fi
if [ ! -z "$stopServer" ]; then
ACTIVE=$(lsof -P -i TCP -s TCP:LISTEN | grep "$PORT")
if [ ! -z "$ACTIVE" ]; then
cd "$TUXPIN_PATH"
xataface stop
else
echo "Server is already stopped"
fi
fi
if [ ! -z "$serverStatus" ]; then
ACTIVE=$(lsof -P -i TCP -s TCP:LISTEN | grep "$PORT")
if [ -z "$ACTIVE" ]; then
echo "Server is not active"
else
echo "Server is currently running on port $PORT"
fi
fi
exit 0
---
# The script title
__title__="Tuxpin Dev Server"
# Script description in Asciidoc format
__description__='''
This script will start or stop the Tuxpin development server.
It will then open it in a new browser window.
. http://localhost:9090/admin.php[Tuxpin Admin]
. http://localhost:9090/phpmyadmin[PHPmyAdmin]
'''
# Tags used to place script into one or more sections of the catalog
__tags__="#tuxpin"
[startServer]
type="button"
label="Start Server"
help="Start tuxpin server"
disposeOnSubmit=false
[stopServer]
type="button"
label="Stop Server"
help="Stop tuxpin server"
disposeOnSubmit=false
[serverStatus]
type="button"
label="Server Status"
help="Check server status"
disposeOnSubmit=false
[openOnStart]
type="checkbox"
label="Open Tuxpin in Browser on Start"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment