473,508 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Kickstart script on server?

Hello

I have a page that mails my customers and it times out...... I need some way
to store it as .vbs and just kickstart it from my asp-page so it'll run in
background.

could you guys show me some code on how to do that? I dont have
visual-studio or anything like that so it's got to be "simple" without any
additional com+ programming or anything like that.

TIA
/Lasse
Jul 19 '05 #1
17 1737
How about this. Have a scheduled task in windows, that checks a database
every five minutes. If a flag says 1, run the VBS script and set the flag
to 0.

Then, you can kickstart it by hitting an ASP page that connects to the same
database and sets the flag to 1.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
Hello

I have a page that mails my customers and it times out...... I need some way to store it as .vbs and just kickstart it from my asp-page so it'll run in
background.

could you guys show me some code on how to do that? I dont have
visual-studio or anything like that so it's got to be "simple" without any
additional com+ programming or anything like that.

TIA
/Lasse

Jul 19 '05 #2
Aaron,

is it possible to send parameters to a vbs script?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
How about this. Have a scheduled task in windows, that checks a database
every five minutes. If a flag says 1, run the VBS script and set the flag
to 0.

Then, you can kickstart it by hitting an ASP page that connects to the same database and sets the flag to 1.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
Hello

I have a page that mails my customers and it times out...... I need some

way
to store it as .vbs and just kickstart it from my asp-page so it'll run in background.

could you guys show me some code on how to do that? I dont have
visual-studio or anything like that so it's got to be "simple" without any additional com+ programming or anything like that.

TIA
/Lasse


Jul 19 '05 #3
Yes, have a look at the WScript documentation at msdn.microsoft.com. You
can also store such parameters in the database when you switch the flag...
that way you have a record of which parameters were used the last time the
VBS script was called.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:Oc*************@TK2MSFTNGP09.phx.gbl...
Aaron,

is it possible to send parameters to a vbs script?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
How about this. Have a scheduled task in windows, that checks a database
every five minutes. If a flag says 1, run the VBS script and set the flag to 0.

Then, you can kickstart it by hitting an ASP page that connects to the same
database and sets the flag to 1.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
Hello

I have a page that mails my customers and it times out...... I need
some way
to store it as .vbs and just kickstart it from my asp-page so it'll

run in background.

could you guys show me some code on how to do that? I dont have
visual-studio or anything like that so it's got to be "simple" without any additional com+ programming or anything like that.

TIA
/Lasse



Jul 19 '05 #4
Aaron,

i need to pass a value "CategoryID" that i then use to select emails from
database.

what's the basic code to schedule a script to run now?

and do i pass it like myscript.vbs categoryid=34 ?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:OG**************@TK2MSFTNGP11.phx.gbl...
Yes, have a look at the WScript documentation at msdn.microsoft.com. You
can also store such parameters in the database when you switch the flag...
that way you have a record of which parameters were used the last time the
VBS script was called.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:Oc*************@TK2MSFTNGP09.phx.gbl...
Aaron,

is it possible to send parameters to a vbs script?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
How about this. Have a scheduled task in windows, that checks a database every five minutes. If a flag says 1, run the VBS script and set the flag to 0.

Then, you can kickstart it by hitting an ASP page that connects to the

same
database and sets the flag to 1.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
> Hello
>
> I have a page that mails my customers and it times out...... I need some way
> to store it as .vbs and just kickstart it from my asp-page so it'll run
in
> background.
>
> could you guys show me some code on how to do that? I dont have
> visual-studio or anything like that so it's got to be "simple"

without any
> additional com+ programming or anything like that.
>
> TIA
> /Lasse
>
>



Jul 19 '05 #5
> i need to pass a value "CategoryID" that i then use to select emails from
database.
Why not store CategoryID in the table, then when you set the flag and the
VBS file wakes up, it grabs the categoryID from the database?
what's the basic code to schedule a script to run now?
I don't know what you mean. Either you call the script directly (however,
there are reasons I recommend not doing this: http://www.aspfaq.com/2059),
or you have windows scheduler run every 5 minutes, or every minute, and
check if it should execute the script.
and do i pass it like myscript.vbs categoryid=34 ?
From the command line, you would call it like this:
wscript c:\file.vbs 34


Then in the VBS file, you would say something like categoryID =
wscript.arguments[0] ... I forget the exact syntax, as I suggested before,
if you really want to go this route, see the documentation at
msdn.microsoft.com. Personally, I think you have your head wrapped around
the ASP framework and you should really look at this from a windows
perspective.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #6
Aaron,

actually user select's category from a list on an asp-page and types his
message he wants to send, now i need to find some way to pass that subject,
body, sender and the selected categoryid to the script.

or a better way....... if its possible to add a job in sql 2002 that looks
something like:

EXEC MyMailProc @CategoryID=34,@Subject='adsf
asdf',@Body='Nsadfasdf',@Se*************@adfs.com'

?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
i need to pass a value "CategoryID" that i then use to select emails from database.


Why not store CategoryID in the table, then when you set the flag and the
VBS file wakes up, it grabs the categoryID from the database?
what's the basic code to schedule a script to run now?


I don't know what you mean. Either you call the script directly (however,
there are reasons I recommend not doing this: http://www.aspfaq.com/2059),
or you have windows scheduler run every 5 minutes, or every minute, and
check if it should execute the script.
and do i pass it like myscript.vbs categoryid=34 ?


From the command line, you would call it like this:
wscript c:\file.vbs 34


Then in the VBS file, you would say something like categoryID =
wscript.arguments[0] ... I forget the exact syntax, as I suggested before,
if you really want to go this route, see the documentation at
msdn.microsoft.com. Personally, I think you have your head wrapped around
the ASP framework and you should really look at this from a windows
perspective.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #7
> actually user select's category from a list on an asp-page and types his
message he wants to send, now i need to find some way to pass that subject, body, sender and the selected categoryid to the script.


I DON'T UNDERSTAND... WHY CAN'T YOU STORE THIS DATA IN THE DATABASE? Why is
your head stuck on passing them as parameters?

Then you can have multiple rows and have the script execute once for each
row. Then you don't have to worry about a second user calling the script
before the first one runs.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #8
Aaron,

since i figured i'd try not to have some script running every single minute
to check if its gonna do something or not
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
actually user select's category from a list on an asp-page and types his
message he wants to send, now i need to find some way to pass that subject,
body, sender and the selected categoryid to the script.


I DON'T UNDERSTAND... WHY CAN'T YOU STORE THIS DATA IN THE DATABASE? Why

is your head stuck on passing them as parameters?

Then you can have multiple rows and have the script execute once for each
row. Then you don't have to worry about a second user calling the script
before the first one runs.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #9
Aaron,

and the email component is on the webserver too, only have one licence, then
i'd have to install it on sql-server too?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
actually user select's category from a list on an asp-page and types his
message he wants to send, now i need to find some way to pass that subject,
body, sender and the selected categoryid to the script.


I DON'T UNDERSTAND... WHY CAN'T YOU STORE THIS DATA IN THE DATABASE? Why

is your head stuck on passing them as parameters?

Then you can have multiple rows and have the script execute once for each
row. Then you don't have to worry about a second user calling the script
before the first one runs.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #10
If this is going to cause performance problems on your server, I suggest
getting a more powerful server. This really shouldn't be a problem, and
avoids all the executable / permissions mess of involving IUSR in running a
local script.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
Aaron,

since i figured i'd try not to have some script running every single minute to check if its gonna do something or not
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
actually user select's category from a list on an asp-page and types his message he wants to send, now i need to find some way to pass that subject,
body, sender and the selected categoryid to the script.


I DON'T UNDERSTAND... WHY CAN'T YOU STORE THIS DATA IN THE DATABASE? Why is
your head stuck on passing them as parameters?

Then you can have multiple rows and have the script execute once for

each row. Then you don't have to worry about a second user calling the script before the first one runs.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


Jul 19 '05 #11
> and the email component is on the webserver too, only have one licence,
then
i'd have to install it on sql-server too?


No, why? A VBS script can run on the web server, check the SQL Server for
data, and execute the email component locally. Or, you can use SQL Server
to send the mail (see http://www.aspfaq.com/2403).
Jul 19 '05 #12
Aaron,

and this wont crash if i it someone triggers it again while it's running?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
and the email component is on the webserver too, only have one licence,

then
i'd have to install it on sql-server too?


No, why? A VBS script can run on the web server, check the SQL Server for
data, and execute the email component locally. Or, you can use SQL Server
to send the mail (see http://www.aspfaq.com/2403).

Jul 19 '05 #13
In the scheme I proposed, a person doesn't trigger the VBS script; windows
scheduler does. And windows scheduler will not execute the script if it has
already been triggered by the scheduler and is still running.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Aaron,

and this wont crash if i it someone triggers it again while it's running?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
and the email component is on the webserver too, only have one
licence, then
i'd have to install it on sql-server too?


No, why? A VBS script can run on the web server, check the SQL Server for data, and execute the email component locally. Or, you can use SQL Server to send the mail (see http://www.aspfaq.com/2403).


Jul 19 '05 #14
Aaron,

yes, but if scheduler triggers that script that is already running, will the
first abort then? or will it finish?

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
In the scheme I proposed, a person doesn't trigger the VBS script; windows
scheduler does. And windows scheduler will not execute the script if it has already been triggered by the scheduler and is still running.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Aaron,

and this wont crash if i it someone triggers it again while it's running?


"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
> and the email component is on the webserver too, only have one

licence, then
> i'd have to install it on sql-server too?

No, why? A VBS script can run on the web server, check the SQL Server for data, and execute the email component locally. Or, you can use SQL Server to send the mail (see http://www.aspfaq.com/2403).



Jul 19 '05 #15
The first will finish, and then it will run again once the scheduler kicks
off again (at the next 1 minute, 5 minutes, or whatever the delay is).

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:#4**************@TK2MSFTNGP12.phx.gbl...
Aaron,

yes, but if scheduler triggers that script that is already running, will the first abort then? or will it finish?

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
In the scheme I proposed, a person doesn't trigger the VBS script; windows
scheduler does. And windows scheduler will not execute the script if it

has
already been triggered by the scheduler and is still running.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Aaron,

and this wont crash if i it someone triggers it again while it's running?

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
> > and the email component is on the webserver too, only have one

licence,
> then
> > i'd have to install it on sql-server too?
>
> No, why? A VBS script can run on the web server, check the SQL

Server for
> data, and execute the email component locally. Or, you can use SQL

Server
> to send the mail (see http://www.aspfaq.com/2403).
>
>



Jul 19 '05 #16
Aaron,

and if script takes longer than 2 min first one wont finish right?
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
The first will finish, and then it will run again once the scheduler kicks
off again (at the next 1 minute, 5 minutes, or whatever the delay is).

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:#4**************@TK2MSFTNGP12.phx.gbl...
Aaron,

yes, but if scheduler triggers that script that is already running, will

the
first abort then? or will it finish?

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
In the scheme I proposed, a person doesn't trigger the VBS script; windows scheduler does. And windows scheduler will not execute the script if it
has
already been triggered by the scheduler and is still running.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Lasse Edsvik" <la***@nospam.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
> Aaron,
>
> and this wont crash if i it someone triggers it again while it's

running?
>
>
> "Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
> news:%2***************@TK2MSFTNGP11.phx.gbl...
> > > and the email component is on the webserver too, only have one
licence,
> > then
> > > i'd have to install it on sql-server too?
> >
> > No, why? A VBS script can run on the web server, check the SQL Server for
> > data, and execute the email component locally. Or, you can use

SQL Server
> > to send the mail (see http://www.aspfaq.com/2403).
> >
> >
>
>



Jul 19 '05 #17
> and if script takes longer than 2 min first one wont finish right?

NO! I suggest you read up on windows scheduler (and re-read what I've
already posted about this in the previous 20 messages). SQL Server's
SQLAgent works the same way.

If I have a job scheduled to run every minute, and one execution take 1:30,
the next execution is skipped. The scheduler doesn't wake up and say, hey
you, you're fired, and start again; it just goes back to sleep until the
next interval, when it checks again. If the previous job is still running,
it goes back to sleep again; if not, it starts up.
Jul 19 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4885
by: DeepBleu | last post by:
When one is using an HTML form via a web broswer, the user submits the form contents and these are passed to a CGI Python script on the web server. I need to write a client script that connects to...
6
2817
by: Paul Winkler | last post by:
This is driving me up the wall... any help would be MUCH appreciated. I have a module that I've whittled down into a 65-line script in an attempt to isolate the cause of the problem. (Real...
16
3976
by: Fox | last post by:
I merged and modified these script which work perfectly fine as long as I use server.execute to access the VBS part (which is itself in another ASP file). When these I use a session variable to...
5
1747
by: news | last post by:
I have a new situation I'm facing and could use a suggestion or two, as I don't seem to be able to think in the abstract very well. We have a local server which holds all of our image files. We...
19
3802
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
1
2660
by: anilkumar1980 | last post by:
Hi All, Here I need help to all of u, I am using ASP.NET 2.0 and Third party Infragistic Controls. I Have included master page in my page (<%@ Page Language="VB"...
3
11269
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
5
3463
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() -...
2
2687
by: Jay | last post by:
I have a web app running on the windows CE device. In one of the asp.net pages - it has javascript code. That seems to have a memory leak. When I run the web app - in about one hour, the app hangs....
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7127
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.