Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
1ac75935
Commit
1ac75935
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
cadba6ee
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
docs/recipes.md
+2
-2
2 additions, 2 deletions
docs/recipes.md
satella/__init__.py
+0
-12
0 additions, 12 deletions
satella/__init__.py
satella/unix/__init__.py
+13
-0
13 additions, 0 deletions
satella/unix/__init__.py
with
18 additions
and
14 deletions
.gitignore
+
3
−
0
View file @
1ac75935
...
@@ -25,6 +25,9 @@ local.properties
...
@@ -25,6 +25,9 @@ local.properties
# Locally stored "Eclipse launch configurations"
# Locally stored "Eclipse launch configurations"
*.launch
*.launch
.vagrant/
.vagrant/
docs/_build/
docs/_static/
docs/_templates
# CDT-specific
# CDT-specific
.cproject
.cproject
...
...
This diff is collapsed.
Click to expand it.
docs/recipes.md
+
2
−
2
View file @
1ac75935
...
@@ -5,7 +5,7 @@ How to do common things.
...
@@ -5,7 +5,7 @@ How to do common things.
## Check if running as root
## Check if running as root
```
python
```
python
from
satella
import
is_running_as_root
from
satella
.unix
import
is_running_as_root
if
is_running_as_root
():
if
is_running_as_root
():
print
(
'
Root!
'
)
print
(
'
Root!
'
)
else
:
else
:
...
@@ -19,7 +19,7 @@ Use a context manager, _AcquirePIDLock_ from module _satella.pid_. Example:
...
@@ -19,7 +19,7 @@ Use a context manager, _AcquirePIDLock_ from module _satella.pid_. Example:
Example:
Example:
```
python
```
python
from
satella.
pidlock
import
AcquirePIDLock
from
satella.
unix
import
AcquirePIDLock
with
AcquirePIDLock
(
'
satella.pid
'
):
with
AcquirePIDLock
(
'
satella.pid
'
):
print
(
'
Lock is acquired!
'
)
print
(
'
Lock is acquired!
'
)
...
...
This diff is collapsed.
Click to expand it.
satella/__init__.py
+
0
−
12
View file @
1ac75935
import
os
def
is_running_as_root
():
"""
Is this process running as root?
Checks whether EUID is 0
:return: bool
"""
return
os
.
geteuid
()
==
0
This diff is collapsed.
Click to expand it.
satella/unix/__init__.py
+
13
−
0
View file @
1ac75935
...
@@ -5,7 +5,20 @@ UNIX things
...
@@ -5,7 +5,20 @@ UNIX things
from
__future__
import
print_function
,
absolute_import
,
division
from
__future__
import
print_function
,
absolute_import
,
division
import
six
import
six
import
logging
import
logging
import
os
from
satella.unix.daemon
import
daemonize
from
satella.unix.daemon
import
daemonize
from
satella.unix.pidlock
import
AcquirePIDLock
from
satella.unix.pidlock
import
AcquirePIDLock
__all__
=
(
'
daemonize
'
,
'
AcquirePIDLock
'
,
'
is_running_as_root
'
)
def
is_running_as_root
():
"""
Is this process running as root?
Checks whether EUID is 0
:return: bool
"""
return
os
.
geteuid
()
==
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment