mirror of
				https://github.com/arcan1s/arcanis.me.git
				synced 2025-10-30 13:23:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			170 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			170 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| ---
 | |
| hastr: true
 | |
| layout: project
 | |
| title: queued
 | |
| short: queued
 | |
| tags: linux, shell, daemon, system
 | |
| hasgui: false
 | |
| hasdocs: false
 | |
| developers:
 | |
|     - Evgeniy Alekseev
 | |
| license: GPLv3
 | |
| links:
 | |
| ---
 | |
| <!-- info block -->
 | |
| <h2><a href="#info" class="anchor" id="info"><span class="octicon octicon-link"></span></a>Information</h2>
 | |
| <p>Daemon for starting jobs to queue of calculations. It was written as proof-of-concept.</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| $ queued --help
 | |
| Simple daemon written on BASH for starting jobs to queue of calculations
 | |
| 
 | |
| Usage: queued [ -c /etc/queued.conf ] [ -v | --version ] [ -h | --help ]
 | |
| Parametrs:
 | |
|   -c               PATH     - path to configuration file. Default is '/etc/queued.conf'
 | |
| 
 | |
|   -v   --version            - show version and exit
 | |
|   -h   --help               - show this help and exit
 | |
| {% endhighlight %}
 | |
| 
 | |
| {% highlight bash %}
 | |
| $ add_queued --help
 | |
| add_queued [ -c /etc/queued.conf ] [ -p NUM ] [ -u USER ] [ -h | --help ] /path/to/script
 | |
| 
 | |
| Parameters:
 | |
|     -c               PATH     - path to configuration file. Default is '/etc/queued.conf'
 | |
|     -p               NUM      - job priority
 | |
|     -u               USER     - username
 | |
|     -h   --help               - show this help and exit
 | |
| {% endhighlight %}
 | |
| 
 | |
| <h3><a href="#devel" class="anchor" id="devel"><span class="octicon octicon-link"></span></a>Developers and contributors</h3>
 | |
| <ul>
 | |
|   {% for devel in page.developers %}
 | |
|     <li>{{ devel }}</li>
 | |
|   {% endfor %}
 | |
| </ul>
 | |
| 
 | |
| <h3><a href="#license" class="anchor" id="license"><span class="octicon octicon-link"></span></a>License</h3>
 | |
| <ul>
 | |
|   <li>{{ page.license }}</li>
 | |
| </ul>
 | |
| <!-- end of info block -->
 | |
| 
 | |
| <!-- install block -->
 | |
| <h2><a href="#install" class="anchor" id="install"><span class="octicon octicon-link"></span></a>Installation</h2>
 | |
| 
 | |
| <h3><a href="#instruction" class="anchor" id="instruction"><span class="octicon octicon-link"></span></a>Instruction</h3>
 | |
| <ul>
 | |
|   <li>Download an <a href="https://github.com/arcan1s/queued/releases" title="GitHub">archive</a> with latest version of source files.</li>
 | |
|   <li>Extract it and install the application:
 | |
| 
 | |
| {% highlight bash %}
 | |
| ./install.sh "/path/to/root/"
 | |
| {% endhighlight %}
 | |
| 
 | |
| If you want install it to <code>/</code> you must run it as root, e.g.:
 | |
| 
 | |
| {% highlight bash %}
 | |
| sudo ./install.sh
 | |
| {% endhighlight %}
 | |
| 
 | |
| If no path is specified it will be installed to <code>/</code> by default.</li>
 | |
| </ul>
 | |
| 
 | |
| <h3><a href="#dependencies" class="anchor" id="dependencies"><span class="octicon octicon-link"></span></a>Dependencies</h3>
 | |
| <p>I want note that all were tested on latest version of dependencies.</p>
 | |
| <ul>
 | |
|   <li>Bash (including awk, grep, sed)</li>
 | |
|   <li>systemd <i>(optional, service file)</i></li>
 | |
| </ul>
 | |
| <!-- end of install block -->
 | |
| 
 | |
| <!-- howto block -->
 | |
| <h2><a href="#howto" class="anchor" id="howto"><span class="octicon octicon-link"></span></a>How to use</h2>
 | |
| <p>If you want to start the daemon just run</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| systemctl start queued
 | |
| {% endhighlight %}
 | |
| 
 | |
| <p>If you want to enable daemon autoload run</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| systemctl enable queued
 | |
| {% endhighlight %}
 | |
| 
 | |
| <p>But you may change path to configuration file or change parameters. To do it just copy (recommended) the source configuration file to new path</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| cp /etc/queued.conf /path/to/new/queued.conf
 | |
| {% endhighlight %}
 | |
| 
 | |
| <p>and edit it. Then copy the source service file to <code>/etc</code>:</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| cp /usr/lib/systemd/system/queued.service /etc/systemd/system/queued-my-profile.service
 | |
| {% endhighlight %}
 | |
| 
 | |
| <p>Replace following string in the file:</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| ExecStart=/usr/bin/queued
 | |
| {% endhighlight %}
 | |
| 
 | |
| <p>to</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| ExecStart=/usr/bin/queued -c /path/to/new/queued.conf
 | |
| {% endhighlight %}
 | |
| 
 | |
| <h3><a href="#adding" class="anchor" id="adding"><span class="octicon octicon-link"></span></a>Adding a job</h3>
 | |
| <ol>
 | |
|   <li>Create shell script with the command (e.g. it have a name <code>script.sh</code>).</li>
 | |
|   <li>Create priority file (<code>script.sh.pr</code>) with the job priority if it is needed.</li>
 | |
|   <li>Create user file (<code>script.sh.user</code>) with the job username if it is needed.</li>
 | |
|   <li>Copy files to <code>$WORKDIR</code>.</li>
 | |
| </ol>
 | |
| <p>Also you may use <code>add_queued</code>.</p>
 | |
| 
 | |
| <h2><a href="#configuration" class="anchor" id="configuration"><span class="octicon octicon-link"></span></a>Configuration</h2>
 | |
| <p>All settings are stored in <code>/etc/queued.conf</code>. After edit them you must restart daemon</p>
 | |
| 
 | |
| {% highlight bash %}
 | |
| systemctl restart queued
 | |
| {% endhighlight %}
 | |
| <!-- end of howto block -->
 | |
| 
 | |
| <!-- config block -->
 | |
| <h3><a href="#options" class="anchor" id="options"><span class="octicon octicon-link"></span></a>Options</h3>
 | |
| <table>
 | |
|   <tr>
 | |
|     <th>WORKDIR</th>
 | |
|     <td>Full path to directory with source jobs. Default is <code>/var/lib/queued/work</code>. This directory must contain source scripts <code>script-name</code>, a priority file (it is not necessary) <code>script-name.pr</code> and a file with username (it is not necessary too) <code>script-name.user</code>.</td>
 | |
|   </tr>
 | |
|   <tr>
 | |
|     <th>JOBDIR</th>
 | |
|     <td>Full path to directory with running jobs. Default is <code>/var/lib/queued/job</code>. All job files will be moved here.</td>
 | |
|   </tr>
 | |
|   <tr>
 | |
|     <th>QUEUEFILE</th>
 | |
|     <td>Full path to file with queue list. Default is <code>/var/lib/queued/queue</code>.</td>
 | |
|   </tr>
 | |
|   <tr>
 | |
|     <th>PRIORITY</th>
 | |
|     <td>Default priority. Default is <code>0</code>. The higher the value, the higher the priority of the task.</td>
 | |
|   </tr>
 | |
|   <tr>
 | |
|     <th>SLEEPTIME</th>
 | |
|     <td>Time interval in minutes. Default is <code>5</code>.</td>
 | |
|   </tr>
 | |
|   <tr>
 | |
|     <th>STARTASUSER</th>
 | |
|     <td>Default user. Default is <code>root</code>. This user will own created files.</td>
 | |
|   </tr>
 | |
| </table>
 | |
| <!-- end of config block -->
 | |
| 
 | |
| <!-- gui block -->
 | |
| <!-- end of gui block -->
 |