How to find success/failure status of a command in different shells?

rajeshkumar created the topic: How to find success/failure status of a command in different shells?

Ksh/Borne/Bash shell
$ ls /usr/bin
….
# when success value is 0
$ echo $?
0
$ ls /usr/bin/blah
ls: 0653-341 The file /usr/bin/blah does not exist
# when failure non-zero status
$ echo $?
1

c/Tcsh
$ ls /usr/bin
….
# when success value is 0
$ echo $status
0
$ ls /usr/bin/blah
ls: 0653-341 The file /usr/bin/blah does not exist
# when failure non-zero status
$ echo $status
1

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Run CreateInstall from the command line

created the topic: Run CreateInstall from the command line? Goto page 1, 2 Next
Hi,

I am wondering if it is possible to use CreateInstall to create an installer package from the command line (according to a specific .ci file).

This way I could create a package using a cmd file. Making the package could be done automatically ….. from a script of mine. Idea

applicationPackaging replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
Yes, you can.

ci.exe

For example

ci.exe “c:\my setups\my.ci”
ci-light.exe c:\temp\my.ci
_________________

replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
ow I am wondering if there is a switch that would suppress the “Creating Installation” Dialog ?

If not, maybe “we” could add this feature in the future? —- Wink

applicationPackaging replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
There is not such feature.
The state of checkboxes is the same as in the previous execution.

replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
Hi,

Before I was Running ci.exe from the command line according to a specific .ci file

I ran from vbscript [ci.exe “File.ci”] it in a hidden window, I still saw the Build Dialog. But I did not see the ci.exe main window.

In CI5 is there a way?
How about cicmd.exe ?

Does ci.exe have any undocumented switches?

I would at the very least like to run from a .cmd file without the Main window and see just the Build Dialog like I can do using vbscript.

I am trying to automate the Packaging operation. I would like it to be Totally quiet, and at the most see the Build Dialog.

I would like to do this without using vbscript.

Any hope for me? Rolling Eyes Rolling Eyes

I noticed if I make an XP shortcut to ci.exe, and in the properties window choose Run Minimized.

Then if you double click the shortcut, ci.exe does Not run minimized. So I cannot use this as a workaround.

applicationPackaging replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
If you want to run creating setups from the command line then use cicmd.exe

cicmd.exe “path to your .ci project file”
Also, see Project tab – > Setup Builder options of your project.

About minimizing shotrcuts
Open cmds\cmds\system\shortcut.gt
Change Line 91 from
2
to
7

Save it. It will fix the problem.

applicationPackaging replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
Great,

cicmd.exe let me run the ci file with the main window minimized.
I only see the Build Dialog Box.

That was a big help.

Alexey I have a cmd script that is parsing and writing the *.ci file.
At the end of the .cmd file, I run the file now using cicmd.exe.

It would really be nice to be able to suppress the Build Dialog.

In my .cmd file I want to parse and create the .ci file, then Build the CreateInstall.exe file.

Then I would like to go on without stopping in my .cmd file, and parse a new *.ci file, and then create a new Installerexe file then perhaps repeat again more times!

But I cannot do this as when I run cicmd.exe the first time, the Build Dialog Opens and I have to close it.

Though I would MUCH prefer to be able to suppress the Build Dialog when using cicmd.exe , I could get by if the Dialog would open then close automatically.

In CI5, checking the box in the Build Dialog for “Close Automatically On Completion” seems to do nothing (even for a re-build).

Help! (a little bit more) Smile

replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
For example, you have a project myproject.ci.
Open it with ci.exe
Open Project Tab – Setup Builder.
Check on ‘Close Automatically’ checkbox there.
Save it.
Now if you run it as
cicmd.exe myproject.ci
then Build Dialog will be closed automatically.

applicationPackaging replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
This may be true, but I never will use cicmd.exe on a .ci file that has been run by double clicking (thru the main window).

So When I run a .ci file with cicmd.exe, a .ci file that has never been run …… when I check the box “Close Automatically” then hit the button “Close”…. (here there is no way to “save”) .

For a new .ci file, the box is always unchecked by default.

I need a preference setting to choose cicmd.exe to always close automatically (for the next time I run a new file with cicmd.exe)

Always on a .ci file never Built, the box is unchecked.
Am I wrong?

replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
You can manage the state of checkboxes from the command line.
-r or -r1 – ‘Launch setup on close’ is checked
-r0 – unchecked
-c or -c1 – ‘Close Automatically’ is checked
-c0 – unchecked

For example,
cicmd.exe -c -r “myproject.ci”

applicationPackaging replied the topic: Re: Run CreateInstall from the command line? Goto page 1, 2 Next
Just what I needed !

That -c1 switch is just “what the Doctor ordered” !

That works and allows me to do what I wanted to do.

Smile Smile Smile Very Happy Very Happy Very Happy Very Happy Very Happy

Thanks for doing such a good job understanding what I wanted to do.
Once again CreateInstall comes thru, and has the power to solve my problem to my perfect satisfaction.

This is rare in the world of software, and I say these things because I am fussy: it seems like I am always wanting to do something the software cannot do.

Also the time it takes to get answers in this forum is super short. Anyone reading this post Knows that real answers do not come quickly in the forums elsewhere on other subjects! I KNOW !!!!!!

All of this represents a level of quality, I for one, only aspire to !
Report This
Quick Reply Action Moderate Thank You

Tagged :

Configure the Knife Command – Chef

configure-the-knife-command

We now have to configure the knife command. This command is the central way of communicating with our server and the nodes that we will be configuring. We need to tell it how to authenticate and then generate a user to access the Chef server.

Luckily, we’ve been laying the groundwork for this step by acquiring the appropriate credential files. We can start the configuration by typing:

knife configure --initial 

This will ask you a series of questions. We will go through them one by one:

WARNING: No knife configuration file found Where should I put the config file? [/home/your_user/.chef/knife.rb]

The values in the brackets ([]) are the default values that knife will use if we do not select a value.

We want to place our knife configuration file in the hidden directory we have been using:

/home/your_user/chef-repo/.chef/knife.rb

In the next question, type in the domain name or IP address you use to access the Chef server. This should begin with https:// and end with :443:

https://server_domain_or_IP:443

You will be asked for a name for the new user you will be creating. Choose something descriptive:

Please enter a name for the new user: [root] station1

It will then ask you for the admin name. This you can just press enter on to accept the default value (we didn’t change the admin name).

It will then ask you for the location of the existing administrators key. This should be:

/home/your_user/chef-repo/.chef/admin.pem

It will ask a similar set of questions about the validator. We haven’t changed the validator’s name either, so we can keep that as chef-validator. Press enter to accept this value.

It will then ask you for the location of the validation key. It should be something like this:

/home/your_user/chef-repo/.chef/chef-validator.pem

Next, it will ask for the path to the repository. This is the chef-repo folder we have been operating in:

/home/your_user/chef-repo

Finally, it will ask you to select a password for your new user. Select anything you would like.

This should complete our knife configuration. If we look in our chef-repo/.chef directory, we should see a knife configuration file and the credentials of our new user:

ls ~/chef-repo/.chef 
admin.pem  chef-validator.pem  knife.rb  station1.pem
Tagged : / / / / / / / / / / / /

How to Setup AWS Credentials using AWS Command Line Interface?

setup-aws-credentials-using-aws-command

Setup AWS Credentails using AWS Command Line Interface

Install the AWS CLI Using Pip
Please click here complete installation guide.

Test the AWS CLI Installation

 $ aws help

Environment Variables – 

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

Step 5: Get a key aws_access_key_id, aws_secret_access_key, region from AWS website, under your 

$ aws configure

Step 6: Setup AWS with key

$  aws configure
AWS Access Key ID [None]: AKIAJB6WCXXXXRKRT5SQ
AWS Secret Access Key [None]: fDBVPhlHzMk70ip5FGHDl/AcmEyMnylwOllc+n4s
Default region name [None]: us-east-1
Default output format [None]:
$  aws s3 list

Step 7: Verify details in ~/.aws/credentials and ~/.aws/config

$ more ~/.aws/credentials
[default]
aws_access_key_id = AKIAJB6WCXXXXRKRT5SQ
aws_secret_access_key = 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

$  more ~/.aws/config
[default]
region = us-east-1

Step 8: Verify AWS CLI setup

$ aws ec2 describe-instances --output table --region us-west-2

The AWS credentials file –

Located at ~/.aws/credentials on Linux, OS X, or Unix, or at C:\Users\USERNAME \.aws\credentials on Windows. This file can contain multiple named profiles in addition to a default profile.

The CLI configuration file –

Typically located at ~/.aws/config on Linux, OS X, or Unix, or at C:\Users\USERNAME \.aws\config on Windows. This file can contain a default profile, named profiles, and CLI specific configuration parameters for each.

Reference
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html

Tagged : / / / / / / / / / / / / / /

Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet

chef-commands-line-reference

To run single recipe using chef-solo

> chef-solo -c /opt/chef/repo/config/solo.rb -o my_cookbook::recipe

To run the single reciepe in same machine

> chef-apply hello.rb

To generate the cookbook standard structure

> chef generate cookbook learn_chef_httpd
> knife cookbook create smartmontools -r md

To generate the template file in cookbook

> chef generate template learn_chef_httpd index.html

To run the cookbook in local mode

> sudo chef-client --local-mode --runlist ‘recipe[learn_chef_httpd]’

To download the cookbooks from market place

> knife cookbook site download learn_chef_httpd
> knife cookbook site install learn_chef_httpd

To Upload the cookbooks to chef server

> knife cookbook upload learn_chef_httpd
> knife cookbook upload -a

To bootstrap a nodes

> knife bootstrap {{address}} --ssh-user {{user}} --ssh-password '{{password}}' --sudo --use-sudo-password --node-name node1 --run-list 'recipe[learn_chef_apache2]'
> knife bootstrap uvo1t75faaktzc532w6.vm.cld.sr -x root -P Br356YS0iy –sudo –node-name firefox
> knife bootstrap 123.45.6.789 -x username -P password –sudo

To see the list of nodes

>knife node list

To edit the node run list

> knife node edit name_of_node

To see the info about each nodes

> knife node show node1

Run the cooksbooks on nodes

> knife ssh {{address}} 'sudo chef-client' --manual-list --ssh-user {{user}} --ssh-password '{{password}}'
> ssh username@ipadddress -i mycredentials.pem sudo chef-client

To add the run list to the nodes.

knife node run_list add C2445575914.domain 'recipe[hptrain]'
knife node run_list set test-node '''recipe[iptables]''' [Windows - Powershell]
knife node run_list set test-node 'recipe[iptables]' [Windows - Command]
Tagged : / / / / / / / / / / / /

Maven CLI Options Reference – Command Line | Maven Command Line Cheatsheet

maven-cli-options-reference

Maven CLI Options Reference

Options Description
-am,--also-make If project list is specified, also build projects required by the list
-amd,--also-make-dependents If project list is specified, also build projects that depend on projects on the list
B,–batch-mode Run in non-interactive (batch) mode
-C,--strict-checksums Fail the build if checksums don’t match
-c,--lax-checksums Warn if checksums don’t match
-cpu,--check-plugin-updates Ineffective, only kept for backward compatibility
-D,--define <arg> Define a system property
-e,--errors Produce execution error messages
-emp,--encrypt-master-password <arg> Encrypt master security password
-ep,--encrypt-password <arg> Encrypt server password
-f,--file <arg> Force the use of an alternate POM file (or directory with pom.xml).
-fae,--fail-at-end Only fail the build afterwards; allow all non-impacted builds to continue
-ff,--fail-fast Stop at first failure in reactorized builds
-fn,--fail-never NEVER fail the build, regardless of project result
-gs,--global-settings <arg> Alternate path for the global settings file
-h,--help Display help information
-l,--log-file <arg> Log file to where all build output will go.
-llr,--legacy-local-repository Use Maven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true
-N,--non-recursive Do not recurse into sub-projects
-npr,--no-plugin-registry Ineffective, only kept for backward compatibility
-npu,--no-plugin-updates Ineffective, only kept for backward compatibility
-nsu,--no-snapshot-updates Suppress SNAPSHOT updates
-o,--offline Work offline
-P,--activate-profiles <arg> Comma-delimited list of profiles to activate
-pl,--projects <arg> Comma-delimited list of specified reactor projects to build instead of all projects. A project can be specified by [groupId]:artifactId or by its relative path.
-q,--quiet Quiet output – only show errors
-rf,--resume-from <arg> Resume reactor from specified project
-s,--settings <arg> Alternate path for the user settings file
-T,--threads <arg> Thread count, for instance 2.0C where C is core multiplied
-t,--toolchains <arg> Alternate path for the user toolchains file
-U,--update-snapshots Forces a check for updated releases and snapshots on remote repositories
-up,--update-plugins Ineffective, only kept for backward compatibility
-V,--show-version Display version information WITHOUT stopping build
-v,--version Display version information
-X,--debug Produce execution debug output
Tagged : / / / / / / / / / / / / / / / / / /

Use of p4 duplicate command | P4 Command Guide

p4-duplicate-command

Use of p4 duplicate command

Problem Area is –
Is there any possibility to rename branch name? as directory rename is possible?

Solution is – p4 duplicate command

What the command ‘p4 duplicate’ was implement to do was create a duplicated revision of a folder as if it always existed. This is explained in the ‘p4 help duplicate’, I have copied below:

Duplicate revisions as if they always existed.  All aspects of
   the source revisions are mirrored into the target revisions,
   including changelist number, date, attributes, and contents.
   The target revision must not already exist, and the target file
must not be opened (for any operation) on any client.

Integration records are duplicated as well.

To rename branch names is possible with the process of a deep rename operation.

p4 duplicate //depot/Jam/MAINds/… //depot/Jam/MAIN/…

The above command will create an exact copy of the branch you’re duplicating including its integration history.

Then the duplication source is not wanted anymore, so you will need to use the obliterate command:

p4 obliterate -y //depot/Jam/MAINds/…

You can find more information about “p4 duplicate” by running the “p4 help duplicate” command.

If you have any further questions please let me know.

Reference –

Perforce Support and

http://maillist.perforce.com/pipermail/perforce-user/2010-November/027364.html

Tagged : / / / / / / / / / / / / / /

Basic Perforce Command – P4 Command Reference

perforce-command-reference

Command

Description

p4 add
Open file(s) in a client workspace for addition to the depot.
p4 admin
Perform administrative operations on the server.
p4 branch
Create or edit a branch specification and its view.
p4 change
Create or edit a changelist specification.
p4 changelists
List submitted and pending changelists.
p4 changelist
Create or edit a changelist specification.
p4 client
Create or edit a client workspace specification and its view.
p4 clients
List all client workspaces currently known to the system.
p4 delete
Open file(s) in a client workspace for deletion from the depot.
p4 depot
Create or edit a depot specification.
p4 depots
Display a list of depots known to the Perforce server.
p4 describe
Provides information about changelists and the changelists’ files.
p4 groups
List groups of users.
p4 group
Add or delete users from a group, or set the maxresults, maxscanrows, and timeout limits for the members of a group.
p4 have
List files and revisions that have been synced to the client workspace
p4 info
Display information about the current client and server.
p4 integrate
Open files for branching or merging.
p4 integrated
Show integrations that have been submitted.
p4 job
Create or edit a defect, enhancement request, or other job specification.
p4 jobs
List jobs known to the Perforce server.
p4 label
Create or edit a label specification and its view.
p4 labels
Display list of defined labels.
p4 lock
Lock an opened file against changelist submission.
p4 login
Log in to a Perforce server by obtaining a ticket.
p4 logout
Log out of a Perforce server by removing or invalidating a ticket.
p4 passwd
Change a user’s Perforce password on the server.
p4 rename
Renaming files under Perforce.
p4 resolve
Resolve conflicts between file revisions.
p4 revert
Discard changes made to open files.
p4 set
Set Perforce variables in the Windows registry.
p4 submit
Send changes made to open files to the depot.
p4 sync
Copy files from the depot into the workspace.
p4 tag
Tag files with a label.
p4 triggers
Edit a list of scripts to be run conditionally whenever changelists are submitted, forms are updated, or when integrating Perforce with external authentication mechanisms.
p4 user
Create or edit Perforce user specifications and preferences.
p4 users
Print a list of all known users of the current server.
p4 verify
Verify that the server archives are intact.
p4 workspace
Create or edit a client workspace specification and its view.
Tagged : / / / / / / / / / /

Unix Command: Grep – Quick Reference – Pattern – Examples – Options

unix-command-grep

Grep scans its input for a pattern, and can display the selected pattern, the line numbers of the filenames where the pattern occurs, The command uses the following syntax

grep options pattern filesname(s)

grep searches for pattern in one or more filenames.

Example for Grep command:

  1. grep “sales” emp.lst
  2. grep “director” emp1.lst emp2.lst
  3. grep ‘jai sharma’ emp.lst
  4. grep “jai Sharma $var” emp.lst

—————-Grep options—————————

Ignoring Case (i) When you look for a name, but you are not sure of the case, grep offers the –i (ignore) option which ignores case for patteen matching.

> Grep –i ‘agarwal’ emp.lst

Deleting Lines  or Inverse(-v): -v (inverse) option selects all except lines containing the pattern. Thus, you can create a file other list containing all but director.

> Grep –v “director” emp.lst > other list

Displaying line Numbers (-n): The –n(number) options displays the line numbers containing the pattern, along with the lines:

> grep –n ‘marketing’ emp.lst

Counting Line Containing patterns (-c): The –c (count) option counts the number of lines containing the pattern ( which is not the same as number of occurrences).

  1. grep –c director emp.lst
  2. grep –c director emp*.lst

Displaying Filenames (-l): The –l (list) option displays only the files names of files containing the pattern.

> grep –l ‘manager’ *.lst

Matching Multiple Patterns(-e): With the –e option, you can match the three agarwals by using grep like this:

> grep –e “Agarwal” –e “aggarwal” –e “agarwal” emp.lst

Taking patterns from a file (-f): we can place all patterns in a separate file, one pattern per lin. Grep takes inputs from there with the –f option:

> grep –f pattern.lst emp.lst

 

Tagged : / / / / / / / / / / / / /