Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| scripting_services_rules_examples [2024/10/17 16:49] – Added a second script crcerror | scripting_services_rules_examples [2025/06/07 06:59] (current) – Scripts and Wikicode crcerror | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| - The **user services** can be created and modified by the user in ''/ | - The **user services** can be created and modified by the user in ''/ | ||
| - | ==== Usage ==== | + | ====== Usage ====== |
| How to write a proper user service script: | How to write a proper user service script: | ||
| Line 25: | Line 25: | ||
| **Enabling** them (with '' | **Enabling** them (with '' | ||
| - | ==== Filename conventions ==== | + | ===== Filename conventions |
| For filenames there are some specfic rules! This is caused as every service-file is exported as systemvariable. So only charaters from A-Z (upper- and lowercase, mixed), the underscore and digits (Please avoid as first character) are allowed. | For filenames there are some specfic rules! This is caused as every service-file is exported as systemvariable. So only charaters from A-Z (upper- and lowercase, mixed), the underscore and digits (Please avoid as first character) are allowed. | ||
| Line 51: | Line 51: | ||
| </ | </ | ||
| - | ==== Conditions ==== | + | ===== Conditions |
| All these scripts are initiated through ''/ | All these scripts are initiated through ''/ | ||
| - | ==== Script Examples ==== | + | ===== Script Examples |
| **Just some examples to show how powerful these kind of scripts can be.** | **Just some examples to show how powerful these kind of scripts can be.** | ||
| Line 113: | Line 113: | ||
| #only on start condition | #only on start condition | ||
| - | [[ $1 == stop ]] && | + | [[ $1 == start ]] || exit 0 |
| # Sanatize Windows-CRLF to unix-style | # Sanatize Windows-CRLF to unix-style | ||
| Line 120: | Line 120: | ||
| pushd / | pushd / | ||
| - | find -type f -printf ' | ||
| while read USER_SERVICE | while read USER_SERVICE | ||
| do | do | ||
| + | grep -rlq $' | ||
| + | |||
| SANATIZE=" | SANATIZE=" | ||
| SANATIZE=" | SANATIZE=" | ||
| Line 128: | Line 129: | ||
| then | then | ||
| mv -b --suffix=_bak " | mv -b --suffix=_bak " | ||
| - | USER_SERVICE=" | ||
| fi | fi | ||
| - | [[ " | + | done < < |
| - | grep -rlq $'\r' | + | |
| - | + | ||
| - | done | + | |
| popd > /dev/null | popd > /dev/null | ||
| Line 145: | Line 142: | ||
| - Setted a bash envirionment with proper seperators | - Setted a bash envirionment with proper seperators | ||
| - | Usually the command for the first codeline (line 3) would be '' | + | Nevertheless the script is able to " |
- scripting_services_rules_examples.1729183764.txt.gz
- Last modified: 20 months ago
- by crcerror