Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mixplorernano-debug/vsv-XTools

 
 

Repository files navigation

vsv - Void Service Manager

Manage and view runit services.

Note: This is a rewrite in Rust of vsv which was originally written in Bash.

vsv was inspired by vpm. vsv is to sv as vpm is to the xbps-* commands.

Installation

python -m venv venv
source venv/bin/activate

Osing CT3

pip install CT3

On Void

    xbps-install -S vsv

Using crates

cargo install vsv

Compile yourself

git clone https://github.com/mixplorernano-debug/vsv-XTools.git
cd vsv
cargo build

curl or wget

You can use curl or wget to pull the script directly from GitHub:

mkdir -p ~/bin
cd ~/bin
wget https://raw.githubusercontent.com/bahamas10/vsv/master/vsv

or

curl -O https://raw.githubusercontent.com/bahamas10/vsv/master/vsv
# and then
chmod +x ~/bin/vsv

Makefile You can use the Makefile in this repo:

sudo make install
cp vsv /usr/local/bin
cp man/vsv.8 /usr/local/share/man/man8/vsv.8

And uninstall with:

sudo make uninstall
rm -f /usr/local/bin/vsv
rm -f /usr/local/share/man/man8/vsv.8

To resolve this issue, you can take one of the following approaches: `` Remove the existing file/directory and then create the symbolic link:

If the existing /var/service is not needed or is incorrect, you can remove it and then create the symbolic link. Use caution when deleting files or directories, as this action is irreversible. Code

    rm -rf /var/service
    ln -s /path/to/target /var/service

Replace /path/to/target with the actual path to the file or directory you want /var/service to link to. `` Force the creation of the symbolic link, overwriting the existing file/directory (if it's a link or file):

If you are certain that the existing /var/service is either a symbolic link or a regular file that you want to replace, you can use the -f (force) option with ln. This will remove the existing entry and create the new symbolic link. Code

    ln -sf /path/to/target /var/service

Again, replace /path/to/target with the correct path. Be cautious with the -f option, as it will delete the existing entry without confirmation. `` Rename the existing file/directory before creating the symbolic link:

If you need to preserve the existing /var/service, you can rename it to something else before creating the new symbolic link. Code

    mv /var/service /var/service_old
    ln -s /path/to/target /var/service

This allows you to keep the old /var/service content while creating the new symbolic link. `` Check if the symbolic link already exists and is correct:

It is possible that the symbolic link you are trying to create already exists and is correctly configured. You can verify this using the ls -l command: Code

    ls -l /var/service

This will show you what /var/service currently points to. If it's already a symbolic link pointing to the correct target, then no action might be necessary.

ps faux | grep libvirt-bin

if you don't see it in ps output - start in manually, then run virt-manager:

sudo service libvirt-bin start

Examples

Run vsv without any arguments to get process status. This is equivalent to running vsv status:

vsv-status

Note: sudo or escalated privileges are required to determine service state because of the strict permissions on each service's supervise directory.

vsv scans the /var/service directory by default, which can be overridden by setting the $SVDIR environmental variable or passing in a -d <dir> argument. Any service that has been in a state for less than 5 seconds will be marked in red and any less than 30 seconds will be marked in yellow, making new or failing services easy to spot:

vsv-add-service.jpg

We can isolate the service by passing it as a "filter" to status.

vsv-filter.jpg

A string can be passed as the first argument after status to filter for services that contain that string in their name. Also, -t can be supplied to status to print the process tree of the pid for that process:

vsv-arguments.jpg

Any command other than status will be passed directly to the sv command. Restarting a service is as easy as vsv restart <svc>:

vsv-restart.jpg

To stop a service, vsv down <svc> or vsv stop <svc> can be used:

vsv-down.jpg

A full service tree can be generated with vsv -t. This command is equivalent to running vsv status -t:

vsv-tree.jpg

-l can be specified to view log services for each service as well. This command is equivalent to running vsv status -l virt:

vsv-log.jpg

-t can be specified with -l to view log services as a tree for each service as well as normal services. This command is equivalent to running vsv status -tl virt:

vsv-log-tree.jpg

Usage

Quick Examples:

  • vsv - show all services
  • vsv status - same as above
  • vsv stop <svc> - stop a service
  • vsv start <svc> - start a service
  • vsv restart <svc> - restart a service
  • vsv enable <svc> - enable a service (autostart at boot)
  • vsv disable <svc> - disable a service (no autostart at boot)
  • vsv hup <svc> - refresh a service (SIGHUP)

Status:

The status subcommand has the following fields:

  • SERVICE - the service (directory) name.
  • STATE - the service state: output from .../$service/supervise/stat.
  • ENABLED - if the service is enabled (lacks the .../$service/down file).
  • PID - the pid of the process being monitored.
  • COMMAND - arg0 from the pid being monitored (first field of /proc/$pid/cmdline.
  • TIME - time the service has been in whatever state it is in.

Command Usage:

$ vsv -h
 __   _______   __
 \ \ / / __\ \ / /   Void Service Manager
  \ V /\__ \\ V /    Source: https://github.com/bahamas10/vsv
   \_/ |___/ \_/     MIT License
   -------------
    Manage and view runit services
    Made specifically for Void Linux but should work anywhere
    Author: Dave Eddy <[email protected]> (bahamas10)

vsv 2.0.0
Runit service manager CLI

USAGE:
    vsv [OPTIONS] [SUBCOMMAND]

OPTIONS:
    -c, --color <yes|no|auto>    Enable or disable color output
    -d, --dir <dir>              Directory to look into, defaults to env SVDIR or /var/service if
                                 unset
    -h, --help                   Print help information
    -l, --log                    Show log processes, this is a shortcut for `status -l`
    -t, --tree                   Tree view, this is a shortcut for `status -t`
    -u, --user                   User mode, this is a shortcut for `-d ~/runit/service`
    -v, --verbose                Increase Verbosity
    -V, --version                Print version information

SUBCOMMANDS:
    disable    Disable service(s)
    enable     Enable service(s)
    help       Print this message or the help of the given subcommand(s)
    status     Show process status

Any other subcommand gets passed directly to the 'sv' command, see sv(1) for
the full list of subcommands and information about what each does specifically.
Common subcommands:

    start <service>           Start the service
    stop <service>            Stop the service
    restart <service>         Restart the service
    reload <service>          Reload the service (send SIGHUP)

Environmental Variables:

  • SVDIR: The directory to use, passed to the sv command, can be overridden with -d <dir>.
  • PROC_DIR: A Linux procfs directory to use for command name lookups, defaults to /proc.
  • SV_PROG: The command to use for any "external" subcommand given to vsv, defaults to sv.
  • PSTREE_PROG: The command to use to get a process tree for a given pid, defaults to pstree.
  • NO_COLOR: Set this environmental variable to disable color output.

Syntax

All source code should be clean of cargo clippy and cargo fmt. You can use make to ensure this:

$ make check
cargo check
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
cargo clippy
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
$ make fmt
cargo fmt

License

MIT License

About

Manage and view runit services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 96.5%
  • Shell 3.1%
  • Makefile 0.4%