Issues while using script (typescript) command with rksh restricted ksh - unix

I have a scenario where I want to log every activity for a particular user. I have a script built around the script command which I invoke from the user's .profile. Now the requirement is that the user should not be able to delete the subsequent typescript file that is created. Towards that, I've created a user with the default shell of rksh and put a restriction on commands that can wipe the file out. But the problem is that when I login with that user, if I call the script with the script command, the forked shell is always sh and not rksh. I know that if SHELL is not set, then the forked shell will be /bin/sh by default, but I have SHELL setup properly. How do I ensure that the forked shell is rksh only?
If I comment out the call to the logger from .profile, then I get a rksh shell. But even then if I manually issue the script command, it launches sh. Any help will be appreciated.
Thank you,

Related

Execute Shell command in tideSDK

I need to run a shell command, that will call the script file that I have written in RUBY
For eg: Lets say, I have a file.sh in my working directory, How can I execute this file using TideSDK( I tried Using the Process)
Titanium Desktop createProcess to run shell script
Is there some other alternatives for this kind of stuffs in tideSDK?
Thanks
UPDATE:
I need to run the ruby script after a click of a button.
I think you don't need to run a process for that. TideSDK allows you to run other scripts like php, ruby and python directly in script tags. On the tag you just need to define the script on the type attribute: text/ruby
There ar several methods to include scripts on TideSDK. Take a look on the documentation at www.tidesdk.org. There is a section related to how to get started.
http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_ruby

Drupal Scheduler module cron

I'm using the Scheduler module to publish and unpublish my content at certain times, however I would like to get a more frequent publish than using the Drupal cron itself.
There is an option within the scheduler for using a lightweight cron specifically for scheduler but I have never written a cron task before and I just simply do not know what I am doing, it gives me an example of how I would write one which is
/usr/bin/wget -O - -q "http://example.com/scheduler/cron"
To make sure I am getting this correctly, would this line (modified to point to my address) go into a file called cron.php?
I have tried doing the above but it doesnt appear to be publishing my content
No, you'll need to add this line to your crontab on the server. Talk to your hosting provider, they should be able to help you.
If you're running your own server, run this command from in the shell:
crontab -e
And add your line last in that file.
See here for more info.

Auto triggering a UNIX shell script

I have a main script in a folder called main.ksh (in /home/pkawar/folder), and its input input file inputfile.xls (in /home/pkawar/folder/ipfile).
When I run main.ksh, it uses inputfile.xls and deliver the output to a mail address.
The inputfile.xls is loaded to path /home/pkawar/folder/ipfile via ftp commands.
Is it possible to run main.ksh automatically and output will be sent via mail when the file inputfile.xls is loaded successfully?
The first option would be to use cron, but from your question it doesn't seem that you want to go that path.
My question would be, what is creating the *.xml file? Is it possible that whatever is creating that file to know when its finished and then calling the shell script, or better yet, have the xml file streamed to the shell script on the fly?
The first thing you should do is write a script that does whatever it is you want done. If your script performs correctly, you can use cron via a crontab file to have the script executed on whatever schedule you desire.
See man crontab for details.

Can I use a scp to download a file using shell script

Can I automate a download of a file from a system using scp(by entering the user id/password) and manipulate the file and upload it to the same place. If you have any idea of using scp in a shell script, pls do let me know
Thanks
Scp is ordinary command line uility in linux so it might be used directly. See this page for examples.
Yes you can automate that from a shell script pretty easily, but the question that remains is whether you want to input the password manually everytime you run the script or use ssh keys to accomplish authentication and achieve full automation.
Check this tutorial on using SCP.
use ssh-copy-id [the command varies by distro, but on Ubuntu it is ssh-copy-id]. here's how:
ssh-copy-id ~/.ssh/id_rsa.pub me#mysite.com this will install your public key to the remote host. it will not ask for your password if you do this! If you have no ~/.ssh/id_rsa.pub, then run ssh-keygen and accept all the default options [just press enter when it prompts for input].

How can I shell out of an ASP.NET page and execute a git command?

I want my ASP.NET page to shell out and execute git commands. I put the commands in a bat file which works:
REM cd to the git repo folder
cd c:\temp\mygitrepo
"c:\Program Files\Git\Bin\git.exe" show c090dc4b8b1b3512c1b5363c371e21d810d02f54 -- myfile.txt
If I run my .bat file from a cmd prompt, no problem.
If I run it using System.Diagnostics.Process.Start, I get this error:
RUNTIME_PREFIX requested, but prefix computation failed. Using static fallback
The error is coming from this git file: http://github.com/git/git/blob/master/exec_cmd.c
I use exactly the same technique to run svn.exe commands, no problem.
EDIT 1: From the thread here I've learned that msysgit installs some files in a location associated with the current user, me, instead of all users. The IIS web server is running under another user account. I tried copying some of the git files that caught my eye, like .gitconfig, to other users (in Documents and Settings). No luck. So, I have switched my focus to getting IIS to impersonate me when it launches the git command.
Is it actually an error, or is it just notifying you of a fallback? Based on the code linked, it appears that the command should still execute successfully, only using the static PREFIX rather than the RUNTIME_PREFIX.
If the command is indeed failing, you might want to make sure that any required environment variables are available when starting the process from .NET. You might also need to impersonate a different windows identity to run the command with proper permissions (I am assuming that the ASP.NET identity is restricted as much as possible.) The ProcessStartInfo object provides a few ways to configure the process, including the windows identity, the process verb, and environment variables. Make sure you are providing the proper context that your batch file requires before running it.

Resources