diff options
Diffstat (limited to 'lib/byteback/util.rb')
-rw-r--r-- | lib/byteback/util.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/byteback/util.rb b/lib/byteback/util.rb index 99a5b23..9a993d6 100644 --- a/lib/byteback/util.rb +++ b/lib/byteback/util.rb @@ -35,8 +35,12 @@ module Byteback end # Own the pidfile ourselves - File.open(@@lockfile, 'w') do |lockfile| - lockfile.puts Process.pid + begin + File.open(@@lockfile, 'w') do |lockfile| + lockfile.puts Process.pid + end + rescue => _ex + fatal("Failed to open lockfile - are you running as root?") end end |