You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
794 B
28 lines
794 B
#!/bin/bash
|
|
set -e
|
|
|
|
PWD=$(pwd)
|
|
SERVICE_NAME="laravel-dev-$(basename "$PWD")"
|
|
|
|
# Check if Laravel project
|
|
if [[ ! -f "artisan" ]]; then
|
|
echo "Error: No artisan file found. Run from Laravel project root."
|
|
exit 1
|
|
fi
|
|
|
|
# Stop existing service if running
|
|
systemctl --user stop "$SERVICE_NAME" 2>/dev/null || true
|
|
|
|
# Start service with current directory
|
|
systemd-run --user \
|
|
--unit="$SERVICE_NAME" \
|
|
--working-directory="$PWD" \
|
|
--setenv=APP_ENV=local \
|
|
--setenv=APP_DEBUG=true \
|
|
php artisan serve --host=127.0.0.1 --port=3000
|
|
|
|
echo "Laravel development server started as user service: $SERVICE_NAME"
|
|
echo "Access at: http://localhost:3000"
|
|
echo "Stop with: ./.linuxdev/stop"
|
|
echo "(Re)start with: ./.linuxdev/start"
|
|
echo "Logs with: journalctl --user -u $SERVICE_NAME -f"
|