Tag Info

Hot answers tagged

10

Running sudo su user01 in a script does not mean the following commands are sent to the resultant shell. In fact, it likely means a new shell is spawned as user01, which never exits! Two things: You can execute a command as another user either by passing the -c 'command...' argument to su, like su user01 -c '/etc/init.d/script start'. Starting a service ...


9

You need IF EXIST instead of just IF for batch programming. e.g. IF NOT EXIST "C:\Program Files\Microsoft Security Client" ( :: Install product )


8

You probably have a carriage return (^M) at the end of your #! line. The format of the #! line is very strict, and carriage return is not allowed there, unless your interpreter is actually called /bin/bash^M There will never be carriage returns in a file created with a proper unix editor, unless you go out of your way to add them. When editing an existing ...


6

In PowerShell: Import-Module ActiveDirectory Get-ADUser MDMarra -Properties scriptpath | Select scriptpath In cmd: dsquery user -samID MDMarra | dsget user -loscr This will return the path of the logon script set in the Profile tab of ADUC. or Just install ADUC on your workstation and look at the Profile tab for the user in question. You don't need ...


6

Your understanding is correct. When your company gets to the size that you need to bring in a dedicated Windows sysadmin they're going to be unhappy that you did this. I can't imagine that your logic is so complex that it couldn't be solved by the built-in functionality in Group Policy. Security Group filtering, WMI filtering (which is ...


6

You might want to look at achieving this via two separate methods, i.e. one to set FF as default, the other to launch it at login. That said, in case you want to know, default browser setting is stored in the registry under HKEY_CURRENT_USER\Software\Classes\http\shell\open\command Use your preferred method for setting registry entries (with your ...


5

Put the command in /etc/rc.local.


5

You could put something in /etc/crontab and run it @reboot @reboot username /etc/init.d/script start


5

Group Policy Filtering: You're doing it wrong (or at the very least you're doing it the hard way). Create a Security group for the computers that you DO want the policy to apply to. Add the appropriate computer accounts to the group. On the Scope tab of the GPO, in the Security Filtering section, remove all entities and add the Security group you created ...


4

I do what you're looking at doing all the time. When you say "I then set permissions on the GPO to deny access to that group" it's not clear what you're doing. Here's my workflow for denying a group the rights to apply a GPO: Create Global Security Group "Computers exempt from printer deletion" Open Group Policy Management, locate the GPO to delete ...


4

If your service already has an init script, you can add it to the default runlevel by running: # rc-update add apache2 default If not, depends on which services system you're using, add your scripts to the /etc/conf.d/local.start or /etc/local.d/baselayout1.start, something like this: cd /path/to/your/app && thin start


4

Sorry for not answering (my own question) sooner. So, this is how I finally settled my problem. On Startup, the Startup Script creates an at job. Since Startup Scripts run as SYSTEM, the at job will similarly run under SYSTEM privileges. The at job is configured to run 2 minutes after creation. The command in the at job is the actual workload script. ...


4

Since you're running AD, why don't you try distributing these products via MSI and GPO?


4

As drive letters are ephemeral, it would be best to use UNC paths instead of drive letters. If the service is unable to handle UNC paths, consider creating a symlink to the destination like mklink c:\remotenetdir \\server\remote\netdir and use the local path (c:\remotenetdir) in the service configuration. Obviously, the service account would need to have ...


3

rc startup order is determined by rcorder, as you've already determined. This process for determining startup order is automatic, and the man page for rcorder is relatively self-explanatory, but you may will want to spend some time reviewing Practical rc.d scripting, and the rc man page before making any changes. In your particular case, you can tell ...


3

The services on a CentOS operating system are managed using chkconfig. Use chkconfig --list to review the currently managed services. You can mark a service to automatically start at a defined runlevel by issuing: # chkconfig someservice on Read the chkconfig(8) manpage for the details.


3

I suppose the shell TERMs it when it exits, which would be immediately, due to the '&'. Maybe you want to use start-stop-daemon? E.g: start-stop-daemon --start -b -x /usr/bin/Xvfb :1 I suppose if you want the help of the startx wrapper, you may want to run your shellscript instead.


3

You can use my init script. It's based on /etc/init.d/skeleton and seems to work well: #! /bin/sh ### BEGIN INIT INFO # Provides: Xvfb # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Xvfb. # Description: Start the X virtual ...


3

On the CentOS machine, create a file in your home directory named .bashrc and set your environmental variables in there. For example, the contents of the file can be: export VARIABLE=foo Here's some discussion of this: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_01.html [edit] Thanks for the clarification. You can use the SendEnv and ...


3

There is already a start-up script for running local commands in /etc/rc.d/local. You can add a line there which executes your program. If your script requires startup/shutdown/restart capabilities, you can add your own script to /etc/init.d. Start by looking at the existing scripts to figure out how to specify dependencies. Once you've created your script, ...


3

Assuming startup script is a batch file: The CALL statement was introduced in MS-DOS 3.3 It is used to call other batch files within a batch file, without aborting the execution of the calling batch file, and using the same environment for both batch files. http://www.robvanderwoude.com/call.php


3

You need to transition this to a logon script, or use the built in application deployment options. The problem you are running into is that during the start up script phase the effective user is not the logged in user - since these scripts are run even before the user logon prompt is presented - but it is running as the SYSTEM user. Personally I would ...


3

Modify /etc/init.d/boot.local to add what you want.


2

While using RVM you have to create an rvm wrapper for thin with rvm wrapper <ruby_version>@<gemset> bootup thin and edit DAEMON variable at /etc/init.d/thin. The actual solution I found here


2

You should grab a copy of psexec and run psexec -s path\to\script.bat. That will run it as System. That's a more accurate manual test than running it as the logged in user, since startup scripts run as SYSTEM.


2

Since you're trying to restrict access to Domain Users to an intranet website, wouldn't it be easier to restrict access to the directory via your Active Directory Controller instead of using a static htaccess file? This way, you can allow certain users to access the website directory where as other users would be denied by default. Change the Everyone ...


2

In order to log all the output to a file, i.e., add the following to all your commands in rc.local: >> /var/log/rc.local.log 2>&1 This will collect both stdout and stderr to /var/log/rc.local.log then you should be able to know what happened.


2

Redirect the output of your script to a file in rc.local e.g. /path/to/yourscript >/tmp/script.out 2>&1 which should capture the stdout and stderr from yourscript.


2

Yes, it technically would work. This is usually combined with the installation of a/the new application. Typically, there would be custom action that would run the uninstall command, that would be incorporated into the transform for the replacement product.



Only top voted, non community-wiki answers of a minimum length are eligible