What I want to achieve
User would provide a command which would do remote execution. Command (protocol for remote execution) can be SSH/RSH... etc. So I want it to be part of a configuration file or a template file (assume parameters are fixed across protocol) like below sample -
template.cfg file (as configured by user):
ssh $ip $commandList
I would generate a list of values in another data file which would contain the ip address and the command list. Like
10.182.215.214|echo $UNAME
10.251.142.142|echo $SHELLNAME
I would like to have a script call it driver.sh which when executed, generates the actual script/scripts with the command from template to another execution script - execute.sh
Questions
How can I generate the script based on template/plugin (which can take liberty and provide the command)?
If the data is generated in an online application (C/C++), other than normal file based operation (read from the cfg file and update the execute.sh) is there any better way?
1.
while IFS=\| read ip commandList
do eval echo $(<template.cfg)
done <data >execute.sh
You may want to quote the variable expansions in the data file.
2.
Since you want the user-provided command to be part of a configuration file, I see no other way than to read from the cfg file; on the other hand, you may well directly execute the generated commands instead of writing them to an execute.sh.
This almost looks as if you're trying to re-implement automated configuration tools like puppet or chef. Beats the ssh loop.
Puppet contains a module called facter, which is used to report/collect all kinds of data about your remote systems.
All of these tools require some setup (public/private keypairs, software installation).
They both have the advantage of builtin logging - good for audits.
Related
Before asking this question I searched a lot about Logging (the terminal Debug Log) into a file for Tizen Application. I figured out some other ways to implement using several alternatives a bit complex pathway for this problem. But I want something straightforward, simple and builtin for Tizen Applications.
So here is what I want -
I will run a Tizen application written in C/C++. It will generate response logs on the terminal based on the several queries I ask to the app.
I want to save those logs into a specific file like file_name.log .
That file_name.log will be saved somewhere within my PC. Developer can change the location as my own.
Is there any command or an existing system for Tizen apps ?
Thank you in advance.
Read https://developer.tizen.org/development/guides/native-application/error-handling/system-logs about Tizen's built-in logging system.
As stated in the page, the logs can be also retrieved from the command line using sdb shell dlogutil [options...] [TAG], or simply sdb dlog [options...] [TAG]. So if you want to save the output as a file, simply do sdb dlog [-d] MY_APP > file_name.log. If this is not what you are searching for, please be more specific in your question.
I know that recent versions of EG can copy files between a SAS server and the local Windows filesystem. But is there any way of getting EG to delete a file as a step in a process flow?
Assuming you're running EG connected to a server that does not have access to your local PC, I don't believe you can without using .NET or something inside EG. You cannot do something like run an X command or similar, because SAS is not on your local machine and can't access it.
It should be possible however to script (using .NET) an extension to EG to do something like this, though (the same way the copy files extension was originally written). But it wouldn't be a SAS process.
Note: The original task was described in a blog post by Chris Hemedinger; that post did not however describe how to actually write such an extension beyond detailing that it uses SAS Workspace APIs. You might look into that first.
I am passing a configuration properties file for a mapreduce program as hadoop jar myprogram.jar -conf config-props.xml
Within my run method, a Job object is created as below:
Configuration conf = new Configuration();
// I want to validate that one configuration properties file is passed here
Job job = new Job(conf, getClass().getSimpleName());
While this works fine, I want to add code before creating a Job object to validate that I am sending one configuration properties file. Looking for help how is it done preferably using a GenericOptionsParser.
GenericOptionsParser is a class that interprets common Hadoop command-line options and sets them on a Configuration object for your application to use as desired. You don’t usually use GenericOptionsParser directly, as it’s more convenient to implement the Tool interface and run your application with the ToolRunner, which uses GenericOptionsParser internally.
Check this link for more details on using GOP.Link to GOP
I have several (15 or so) builds which all reference the same string of text in their respective build process templates. Every 90 days that text expires and needs to be updated in each of the templates. Is there a way to create a central variable or argument
One solution would be to create an environment variable on your build machine. Then reference the variable in all of your builds. When you needed to update the value you would only have to set it in one place.
How to: Use Environment Variables in a Build
If you have more than one build machine then it could become too much of a maintenance issue.
Another solution would involve using MSBuild response files. You create an .rsp file that holds the property value and the value would be picked up and set from MSBuild via the command line.
You need to place it into somewhere where all your builds can access it, then customize your build process template to read from there (build definitions - as you know - do not have a mechanism to share data between defs).
Some examples would be a file checked into TFS, a file in a known location (file share), web page, web service, etc.
You could even make a custom activity that knew how to read it and output the result as an OutArgument (e.g. Custom activity that read the string from a hardcoded URL).
The debug settings are stored in a .user file which should not be added to source control. However this file does contain useful information. Now I need to set each time I trying to build a fresh checkout.
Is there some workaround to make this less cumbersome?
Edit: It contains the debug launch parameters. This is often not really a per-user setting. The default is $(TargetPath), but I often set it to something like $(SolutionDir)TestApp\test.exe with a few command line arguments. So it isn't a local machine setting per se.
Well, I believe this file is human readable (xml format I think?), so you could create a template that is put into source control that everyone would check out, for instance settings.user.template. Each developer would than copy this to settings.user or whatever the name is and modify the contents to be what they need it to be.
Its been a while since I've looked at that file, but I've done similar things to this numerous times.
Set the debug launch parameters in a batch file, add the batch file to source control. Set the startup path in VS to startup.bat $(TargetPath).