1#!/usr/bin/env bash
2
3#
4# rserver-dev
5#
6# Copyright (C) 2021 by RStudio, PBC
7#
8# Unless you have received this program directly from RStudio pursuant
9# to the terms of a commercial license agreement with RStudio, then
10# this program is licensed to you under the terms of version 3 of the
11# GNU Affero General Public License. This program is distributed WITHOUT
12# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
13# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
14# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
15#
16#
17#
18# remove stream files/dirs
19cleanupStreams()
20{
21   rm -rf /tmp/rstudio-server
22}
23cleanupStreams
24
25# generic cleanup routine
26cleanup()
27{
28   killall -SIGUSR2 rsession 2>/dev/null
29   killall -SIGUSR2 rworkspaces 2>/dev/null
30   cleanupStreams
31   exit $?
32}
33trap cleanup SIGINT
34
35RS_CRASH_HANDLER_PATH="$(pwd)/server/crash-handler-proxy/crash-handler-proxy" \
36   RS_CRASHPAD_HANDLER_PATH="${RSTUDIO_TOOLS_ROOT}/crashpad/crashpad/out/Default/crashpad_handler" \
37   RS_DB_MIGRATIONS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/server/db" \
38   server/rserver --server-user $(whoami) --config-file conf/rserver-dev.conf "$@"
39
40