This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Other deployment actions here. Want to install (or bounce) service last. | |
if [ -f /etc/systemd/system/arcadely.service ]; then | |
sudo systemctl stop arcadely.service | |
sudo systemctl disable arcadely.service | |
else | |
sudo \cp -f ./arcadely.service /etc/systemd/system/arcadely.service | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Arcade.ly Node.js Server | |
#Requires=After=mysql.service # Requires the mysql service to run first | |
[Service] | |
ExecStart=/usr/bin/node /home/ubuntu/arcade/build/production/index.js | |
Restart=always | |
RestartSec=10 # Restart service after 10 seconds if node service crashes | |
StandardOutput=syslog # Output to syslog | |
StandardError=syslog # Output to syslog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Arcade.ly node.js server" | |
author "Bart Read" | |
# used to be: start on startup | |
# until we found some mounts weren't ready yet while booting | |
start on started mountall | |
stop on shutdown | |
# automatically respawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NODEPROCESSES=$(ps -aux | grep '[s]udo nohup node index.js' | awk '{print $2}') | |
if [ -n "$NODEPROCESSES" ]; then | |
echo "Found node processes $NODEPROCESSES" | |
else | |
echo "No node processes found" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [YOUR_DATABASE_NAME]; -- Substitute for your database name | |
GO | |
SELECT TOP 10 -- Change as appropriate | |
t.text , | |
s.sql_handle , | |
s.plan_handle , | |
s.total_worker_time / 1000 AS total_cpu_time_millis , | |
s.total_worker_time / s.execution_count / 1000 AS avg_cpu_time_millis , | |
s.total_logical_reads, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT [cpu_ticks] , | |
[ms_ticks] , | |
[cpu_count] , | |
[hyperthread_ratio] , | |
[physical_memory_kb] , | |
[virtual_memory_kb] , | |
[committed_kb] , | |
[committed_target_kb] , | |
[visible_target_kb] , | |
[stack_size_in_bytes] , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT o.[object_id] AS [ObjectID], | |
s.[name] AS [SchemaName], | |
o.[name] AS [ObjectName], | |
s.[name] + '.' + o.[name] AS [QualifiedName], | |
o.[type] | |
FROM sys.objects AS o | |
INNER JOIN sys.schemas AS s ON o.schema_id = s.schema_id | |
ORDER BY [QualifiedName]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This query allows you to relate activity in tempdb to activity in other databases | |
where that activity has been recorded in a SQL Profiler trace table. | |
This can come in useful when, for example, diagnosing the source of I/O activity | |
and possible bottlenecking in tempdb. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT te.name | |
FROM [YOUR_TRACE_SCHEMA_NAME].[YOUR_TRACE_TABLE_NAME] AS d | |
INNER JOIN sys.trace_events AS te | |
ON te.trace_event_id = d.EventClass; |