Sponsored Content
Top Forums Programming Programming a Telegram Bot Using Node-RED, PHP, and MySQL Post 303045167 by RavinderSingh13 on Friday 13th of March 2020 12:16:55 AM
Old 03-13-2020
Quote:
Originally Posted by Neo
Good job Ravinder.
Always a pleasure to see people learning new things and using that knowledge to solve real-world problems.
Can you use kind of system at your work?
Thank you for encouragement Neo Smilie

Yes, I did some stuff from this one(already written almost 8 to 9 functions).

But in company I believe they will NOT allow Telegram(since it could be information breach; usually sites apps like Whats app, telegram are NOT trusted in firms) so I am thinking to do this with Microsoft's Skype(which is official and is used in firms too). Let me have more hands on with this one at home then I will try to implement this with official communicator etc.

And again yes, its very powerful; right now I written functions for eg-->
  • 1- Know number of opened files in a server(where code is deployed basically for time being, not connected to other servers).
  • 2- Check disk space for mount(will enhance it to take input from user for mount).
  • 3- Check number of running processes in system.
  • 4- Get N number of lines(entered by user value) of log file.
  • 5- Know system's uptime.
  • 6- Starting and stopping tomcat in progress.
  • 7- Installing few software (like tomcat, systemd etc) are in progress.

I will post a detailed version of it over weekend(migration cancelled this weekend).

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
 

7 More Discussions You Might Find Interesting

1. Red Hat

Can't uninstall MYSQL from RED HAT ES

Hi Everyone Could you kindly advise on how I should do a chkconfig and uninstalling mysql rpm on Red hat ES.Please check the errors that I'm getting below. :eek: I need to uninstall MySQL completely from my linux system ver 2.4.21-37 and use the chkconfig command to switch it on... (15 Replies)
Discussion started by: CollenM
15 Replies

2. What is on Your Mind?

Telegram Bots - Bot Code Examples

I'm currently looking into ways to integrate the Telegram API into the forums: Telegram Bots - Bot Code Examples I'm thinking, first off, to use the Telegram API to get forum alerts and notifications (to Bot or Not?). Second, I thinking of ways to more deeply integrate Telegram into the... (5 Replies)
Discussion started by: Neo
5 Replies

3. Web Development

Node.js and mysql - ER_ACCESS_DENIED_ERROR

This problem has been killing me all day, and I cannot solve it. Basically, I am using node.js with the mysql module and it will not connect to the database. Here is the JS code snippet in node.js: app.get("/test", function(req, res) { var mysql = require("mysql"); var con =... (4 Replies)
Discussion started by: Neo
4 Replies

4. Infrastructure Monitoring

Using Node-RED and MQTT to Monitor Server and Application Stats

After setting up MQTT and testing some ESP8266 and ESP32 modules, where I noted that testing in Programming ESP32 (ESP-WROOM-32) as an MQTT Client Subscribed to Linux Server Load Average Messages, I was so impressed with MQTT that I installed MQTT on three different computers, instantly and... (2 Replies)
Discussion started by: Neo
2 Replies

5. Programming

Publish and Subscribe to AES-256 Encrypted MQTT Messages to Node-RED from PHP Scripts

Various Node-Red crypto modules do not work with PHP, so to send an encrypted message from a PHP script (in this case from a Ubuntu server) to Node-RED we need our own code. After a few hours of searching, testing various libs, more testing and debugging, I got this PHP to Node-RED code... (0 Replies)
Discussion started by: Neo
0 Replies

6. Programming

Node-RED: Writing MQTT Messages to MySQL DB with UNIX timestamp

First, I want to thank Neo (LOL) for this post from 2018, Node.js and mysql - ER_ACCESS_DENIED_ERROR I could not get the Node-RED mysql module to work and searched Google until all my links were purple! I kept getting ER_ACCESS_DENIED_ERROR with the right credentials. Nothing on the web was... (0 Replies)
Discussion started by: Neo
0 Replies

7. What is on Your Mind?

MQTT, Node-RED, Linux, Apache2, MySQL, PHP, Telegram, ESP32, ESP8266, Arduino

I have just completed the first phase of integrating all these devices and technologies: MQTT, Node-RED, Linux, Apache2, MySQL, PHP, Telegram, ESP32, ESP8266, and the Arduino Uno The glue that binds all this together is MQTT. In fact, MQTT makes this kind of integration nearly trivial to... (1 Reply)
Discussion started by: Neo
1 Replies
SYSTEMD.GENERATOR(7)						 systemd.generator					      SYSTEMD.GENERATOR(7)

NAME
systemd.generator - systemd unit generators SYNOPSIS
/path/to/generator normal-dir early-dir late-dir /run/systemd/system-generators/* /etc/systemd/system-generators/* /usr/local/lib/systemd/system-generators/* /lib/systemd/system-generators/* /run/systemd/user-generators/* /etc/systemd/user-generators/* /usr/local/lib/systemd/user-generators/* /usr/lib/systemd/user-generators/* DESCRIPTION
Generators are small executables that live in /lib/systemd/system-generators/ and other directories listed above. systemd(1) will execute those binaries very early at bootup and at configuration reload time -- before unit files are loaded. Generators may dynamically generate unit files (regular ones, instances as well as templates) and unit file .d/ drop-ins, or create symbolic links to unit files to add additional dependencies or instantiate existing templates, thus extending or overriding existing definitions. Their main purpose is to convert configuration files that are not native unit files dynamically into native unit files. Generators are loaded from a set of paths determined during compilation, as listed above. System and user generators are loaded from directories with names ending in system-generators/ and user-generators/, respectively. Generators found in directories listed earlier override the ones with the same name in directories lower in the list. A symlink to /dev/null or an empty file can be used to mask a generator, thereby preventing it from running. Please note that the order of the two directories with the highest priority is reversed with respect to the unit load path, and generators in /run overwrite those in /etc. After installing new generators or updating the configuration, systemctl daemon-reload may be executed. This will delete the previous configuration created by generators, re-run all generators, and cause systemd to reload units from disk. See systemctl(1) for more information. WRITING GENERATORS
Generators are invoked with three arguments: paths to runtime directories where generators can place their generated unit files or symlinks. 1. normal-dir argv[1] may be used to override unit files in /usr, but not those in /run or in /etc. This means that unit files placed in this directory take precedence over vendor unit configuration but not over native user/administrator unit configuration. 2. early-dir argv[2] may be used to override unit files in /usr, in /run and in /etc. This means that unit files placed in this directory take precedence over all configuration, both vendor and user/administrator. 3. late-dir argv[3] may be used to extend the unit file tree without overriding any other unit files. Any native configuration files supplied by the vendor or user/administrator take precedence over the generated ones placed in this directory. Notes o All generators are executed in parallel. That means all executables are started at the very same time and need to be able to cope with this parallelism. o Generators are run very early at boot and cannot rely on any external services. They may not talk to any other process. That includes simple things such as logging to syslog(3), or systemd itself (this means: no systemctl(1))! Non-essential file systems like /var and /home are mounted after generators have run. Generators can however rely on the most basic kernel functionality to be available, including a mounted /sys, /proc, /dev, /usr. o Units written by generators are removed when the configuration is reloaded. That means the lifetime of the generated units is closely bound to the reload cycles of systemd itself. o Generators should only be used to generate unit files and symlinks to them, not any other kind of configuration. Due to the lifecycle logic mentioned above, generators are not a good fit to generate dynamic configuration for other services. If you need to generate dynamic configuration for other services, do so in normal services you order before the service in question. o Since syslog(3) is not available (see above), log messages have to be written to /dev/kmsg instead. o It is a good idea to use the SourcePath= directive in generated unit files to specify the source configuration file you are generating the unit from. This makes things more easily understood by the user and also has the benefit that systemd can warn the user about configuration files that changed on disk but have not been read yet by systemd. o Generators may write out dynamic unit files or just hook unit files into other units with the usual .wants/ or .requires/ symlinks. Often, it is nicer to simply instantiate a template unit file from /usr with a generator instead of writing out entirely dynamic unit files. Of course, this works only if a single parameter is to be used. o If you are careful, you can implement generators in shell scripts. We do recommend C code however, since generators are executed synchronously and hence delay the entire boot if they are slow. o Regarding overriding semantics: there are two rules we try to follow when thinking about the overriding semantics: 1. User configuration should override vendor configuration. This (mostly) means that stuff from /etc should override stuff from /usr. 2. Native configuration should override non-native configuration. This (mostly) means that stuff you generate should never override native unit files for the same purpose. Of these two rules the first rule is probably the more important one and breaks the second one sometimes. Hence, when deciding whether to use argv[1], argv[2], or argv[3], your default choice should probably be argv[1]. o Instead of heading off now and writing all kind of generators for legacy configuration file formats, please think twice! It is often a better idea to just deprecate old stuff instead of keeping it artificially alive. EXAMPLES
Example 1. systemd-fstab-generator systemd-fstab-generator(8) converts /etc/fstab into native mount units. It uses argv[1] as location to place the generated unit files in order to allow the user to override /etc/fstab with her own native unit files, but also to ensure that /etc/fstab overrides any vendor default from /usr. After editing /etc/fstab, the user should invoke systemctl daemon-reload. This will re-run all generators and cause systemd to reload units from disk. To actually mount new directories added to fstab, systemctl start /path/to/mountpoint or systemctl start local-fs.target may be used. Example 2. systemd-system-update-generator systemd-system-update-generator(8) temporarily redirects default.target to system-update.target, if a system update is scheduled. Since this needs to override the default user configuration for default.target, it uses argv[2]. For details about this logic, see systemd.offline-updates(7). Example 3. Debugging a generator dir=$(mktemp -d) SYSTEMD_LOG_LEVEL=debug /lib/systemd/system-generators/systemd-fstab-generator "$dir" "$dir" "$dir" find $dir SEE ALSO
systemd(1), systemd-cryptsetup-generator(8), systemd-debug-generator(8), systemd-fstab-generator(8), fstab(5), systemd-getty-generator(8), systemd-gpt-auto-generator(8), systemd-hibernate-resume-generator(8), systemd-rc-local-generator(8), systemd-system-update-generator(8), systemd-sysv-generator(8), systemd.unit(5), systemctl(1), systemd.environment-generator(7) systemd 237 SYSTEMD.GENERATOR(7)
All times are GMT -4. The time now is 06:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy